rsdb.net
当前位置:首页 >> sqlsErvEr iF >>

sqlsErvEr iF

跟程序中使用差不多,if,else if,else,只不过在sqlserver中,{}使用begin和end代替,里面嵌套什么的,都跟程序中写的差不多,简单实例如下: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 3...

你可以测试一下就知道了 DECLARE @Number int; SET @Number = 50; IF @Number > 100 PRINT 'The number is large.'; ELSE BEGIN IF @Number < 10 PRINT 'The number is small.'; ELSE PRINT 'The number is medium.'; END ; GO

IF EXISTS (SELECT * FROM SYSOBJECTS WHERE NAME='#temp') DROP TABLE #temp GO SELECT ID,XM,ADDDW INTO #temp FROM CKZD GO SELECT * #temp DROP TABLE #temp 临时表用完就要删

if (select count(*) from A1 where dic like '%auth_info%')>0 或者 if exists(select * from A1 where dic like '%auth_info%')

if a>bBegin print 'a'EndElse if a

if 2

跟程序中使用差不多,if,else if,else,只不过在sqlserver中,{}使用begin和end代替,里面嵌套什么的,都跟程序中写的差不多,简单实例如下: declare @a intset @a=1if @a0 and @a

可以用 case when 代替 where if 例如 select * from tb where case when id=1 then id end=?

答案是:C

参考下例:(t_2即为临时表) iihero=# select * from t1; id | col2 | col3 ----+------+------ 1 | abc | 2 (1 row) iihero=# create temporary table t_2 as select * from t1; SELECT iihero=# select * from t_2; id | col2 | col3 ----+----...

网站首页 | 网站地图
All rights reserved Powered by www.rsdb.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com