2017年4月12日

通过写《费用明细表》发现写sql的乐趣

摘要: declare @strsql varchar(max)declare @strsql1 varchar(max)declare @strsql2 varchar(max) = '' set @strsql = 'select * from (select distinct case when (s 阅读全文

posted @ 2017-04-12 15:21 hushzhang 阅读(976) 评论(0) 推荐(1) 编辑

SQL中的declare用法

摘要: 平时写SQL查询、存储过程都是凭着感觉来,没有探究过SQL的具体语法,一直都是按c#那一套往SQL上模仿,前几天项目中碰到一个问题引起了我对declare定义变量的作用域的兴趣。 大家都知道c#中的局部变量,在if中如果我们定义一个变量的话他的作用到if结束为止,if外是不识别这个变量的,else里 阅读全文

posted @ 2017-04-12 14:55 hushzhang 阅读(142447) 评论(1) 推荐(5) 编辑

导航