Skip to main content

Posts

Showing posts with the label create and insert into temp table in sql server

Create and insert into temp table in sql server

// CREATEAND INSERT INTO TEMP TABLE IN SQL SERVER DECLARE @S VARCHAR ( 8000 ), @Split CHAR ( 1 ), @leng BIGINT ,                   @percoll VARCHAR ( 8000 ), @cnt BIGINT          SET @Str = '4,5,6,7'              SET @Split = ',' SET @leng = ( SELECT COUNT (*) FROM dbo . SplitString ( @Str , @Split )) DECLARE @temp TABLE (   ID BIGINT IDENTITY ( 1 , 1 ), RoleID BIGINT , count INT ) INSERT INTO @temp                 SELECT * FROM (                                 SELECT RoleID , COUNT (*) AS [Count] FROM [d...