Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
delbar
Starting Member
5 Posts |
Posted - 2009-11-26 : 04:02:33
|
| I have a sproc that calls a procedure to retrieve information and the procedure has a variable @QTRYYYY. I have a parameter called @dateval that retrieves the @QTRYYYY from the procedure. I am new to this....@DateVal as varchar (5)Declare @people table (NewPK int identity(1,1), Org char(3) null,License char(6) null,@DateVal varchar (5) null)insert into @peopleexec spGetRows @DateValend;with CTEpeople(org, License, Type, Category, CategoryCount, @DateVal)as (Select org, license, type, @DateVal from @peopleetc....this is not working. any suggestions on how to get the @DateVal into a table?thanks, |
|
|
rajdaksha
Aged Yak Warrior
595 Posts |
Posted - 2009-11-26 : 04:18:16
|
quote: Originally posted by delbar I have a sproc that calls a procedure to retrieve information and the procedure has a variable @QTRYYYY. I have a parameter called @dateval that retrieves the @QTRYYYY from the procedure. I am new to this....@DateVal as varchar (5)Declare @people table (NewPK int identity(1,1), Org char(3) null,License char(6) null,@DateVal varchar (5) null)insert into @peopleexec spGetRows @DateValend;with CTEpeople(org, License, Type, Category, CategoryCount, @DateVal)--this is erroras (Select org, license, type, @DateVal from @peopleetc....this is not working. any suggestions on how to get the @DateVal into a table?thanks,
try this..HiYou expect this...DECLARE @DATEVAL INTSET @DATEVAL = 1DECLARE @PEOPLE TABLE (NEWPK INT IDENTITY(1,1), ORG CHAR(3) NULL)INSERT INTO @PEOPLEEXEC SPGETROWS @DATEVALSELECT * FROM @PEOPLE;WITH CTEPEOPLE(NEWPK, ORG, DATEVAL)AS ( SELECT NEWPK, ORG, @DATEVAL FROM @PEOPLE)SELECT * FROM CTEPEOPLECREATE proc spGetRows @DateVal int as begin if @DateVal = 1 select 'delbar' end -------------------------R... |
 |
|
|
delbar
Starting Member
5 Posts |
Posted - 2009-11-26 : 04:46:53
|
| Thank you it worked! |
 |
|
|
|
|
|
|
|