Discussion Locked

Moving Access Queries to SQL Server

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
I am in the process of moving an access 2000 database to SQL Server. I was able to move the SQL code from most of the queries into SQL server and create views, but several of the queries have embedded VB statements (mostly iif statements or datepart function) and wouldn't move over. What is the best way to recreate these in SQL Server so that I can get to them through my web site?

5 replies

by ohjani

u have to do it one by one, change all the datepart function to CONVERT function sql server. and also dun forget the wild card search "*", sql server uses "%".

by macbeth

For iif statements use CASE.
SELECT CASE
WHEN state = 'WA' THEN 'Near the Indian Ocean'
WHEN state = 'QLD' THEN 'Near the Pacific Ocean
ELSE 'Dunno where we are'
FROM MyTable

This discussion is closed to new replies.