mysql中的if()函数在sqlserver中类似的写法
MySQL:if(1=1,'1','2')
SQL server:case when 1=1 then 1 else 2 end as 新字段名
示例:
SELECT TOP 1000 [id]
,case when [id]=7 then [id]+10000 else [id] end as id1
FROM [xxx].[dbo].[xxx]
mysql中的if()函数在sqlserver中类似的写法
MySQL:if(1=1,'1','2')
SQL server:case when 1=1 then 1 else 2 end as 新字段名
示例:
SELECT TOP 1000 [id]
,case when [id]=7 then [id]+10000 else [id] end as id1
FROM [xxx].[dbo].[xxx]