拼接列值
Select ID + ',' From UserInfo FOR XML PATH('')
快速创建临时表:
IF OBJECT_ID( 'tempdb..#tmpUser' ) IS NOT NULL
DROP TABLE #tmpUser
SELECT *
INTO #tmpUser
FROM Sys_User
将存储过程的结果插入到临时表
--1,先创建表(必须的)
CREATE TABLE #storerSizeInv( StorerID VARCHAR( 100 ), StorerCode VARCHAR( 100 )...)
--2,插入到临时表
INSERT INTO #storerSizeInv
EXEC spWms_Inv_GetStorerInfo @CompanyID, @StockID, '', @SubAreaIDS
快速创建(下面两句是一体的)
with result as(select id,name,code from student)
select * from result (紧接着使用result表就可以<select,连接等等>)