
SQL
Carpe_D1em
这个作者很懒,什么都没留下…
展开
-
SQL中在查询结果中新增一列自定义的值
select sale_no,cast('自定义的值' as '自定义的字段类型') as '列名' from incomeManagewhere sale_no not in ( select sale_no from saleManage )原创 2018-08-28 13:18:43 · 26360 阅读 · 1 评论 -
SQL语句中EXCEPT和INTERSECT用法
--EXCEPT 取两个查询结果的差集select sale_no ,sale_day ,sale_money from saleManageexceptselect sale_no ,sale_day ,sale_money from incomeManage --INTERSECT 取两个查询结果的交集select sale_no ,sale_day ,sale_mo...原创 2018-08-28 13:31:26 · 11386 阅读 · 3 评论 -
SQL临时表的创建和删除
if OBJECT_ID ('tempdb..#t1') is not null begin drop table #t1 endelse begin create table #t1( s_no char(8), s_day char(8), s_money int, err text ) ...原创 2018-08-29 08:14:41 · 14593 阅读 · 0 评论 -
SQL 解决INSERT EXEC 语句不能嵌套问题
--创建无参数的表值函数,不要使用存储过程--在需要调用的存储过程中 insert into #tempTable select * from [dbo.][FUNC_SaveData]()CREATE FUNCTION FUNC_SaveData()returns tableasreturn( select * from tableName) ...原创 2018-08-29 10:26:31 · 6200 阅读 · 0 评论