Working in a stored procedure for the first time...
I have a variable....
Declare @CountNew as varchar(3)
I don't think this is right, but I have next....
Set @CountNew = "Select Count(*) as NewAccounts
from server.db.dbo.table
where SGMTNUMB = 3 and SGMNTID Not In (Select SGMNTID from PrevCostCenter)"
I want the @CountNew to take on the number of records the sql statement produces. I do not want the @CountNew to equal the whole string of the statement.
I then want to use @CountNew to determine if I have results and continue on with producing a file and sending an e-mail.
Any help would be appreciated.
I have a variable....
Declare @CountNew as varchar(3)
I don't think this is right, but I have next....
Set @CountNew = "Select Count(*) as NewAccounts
from server.db.dbo.table
where SGMTNUMB = 3 and SGMNTID Not In (Select SGMNTID from PrevCostCenter)"
I want the @CountNew to take on the number of records the sql statement produces. I do not want the @CountNew to equal the whole string of the statement.
I then want to use @CountNew to determine if I have results and continue on with producing a file and sending an e-mail.
Any help would be appreciated.