
August 1st, 2003, 04:58 AM
|
|
Junior Member
|
|
Join Date: Aug 2003
Posts: 1
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
MySQL query to SQL server query
Can you help me with the following? I’ve to change MySQL queries to SQL Server queries.
The original query is:
INSERT INTO codebook(SELECT tableid, name, tablename, NULL, IF(modify=0,'y','n'), 'y' FROM commontables)
I change it into
1.
INSERT INTO codebook( codelistid, name, tablename, parentid, special, active)
SELECT tableid, name, tablename, NULL, 'IF(modify=0,'y','n')', 'y'
FROM commontables
Not good: Line 2: Incorrect syntax near ','
2.
INSERT INTO codebook( codelistid, name, tablename, parentid, special, active)
SELECT tableid, name, tablename, NULL, modify , 'y'
FROM commontables
WHERE special= 'IF(modify=0,''y'',''n'')'
Again: Invalid column name 'special'
May be the problem is in type “special” is char(1), “modify” int(4)?Not good: Again:
|