shilpi2
asked on
count
hi experts,
I am trying to count the rows in a table and assign the count to a variable.
I am getting an error in this case.
says that:
Server: Msg 170, Level 15, State 1, Procedure IDX_Daily_Security_Dollars _Earned_Ca lc_Strateg y, Line 98
Line 98: Incorrect syntax near '@a'.
I am trying to count the rows in a table and assign the count to a variable.
I am getting an error in this case.
says that:
Server: Msg 170, Level 15, State 1, Procedure IDX_Daily_Security_Dollars
Line 98: Incorrect syntax near '@a'.
declare @a int
SELECT COUNT(StartDate) into @a FROM #TEMP_All_Dates
if @a=1
begin
insert into #TEMP_All_Dates(StartDate) values (null)
end
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
@shilpi2
Could you please split the points? The expert LowfatSpread's has given a neat answer and that will be better than my solution.
Thanks for the understanding.
Could you please split the points? The expert LowfatSpread's has given a neat answer and that will be better than my solution.
Thanks for the understanding.
insert into #TEMP_All_Dates(StartDate)
Select null from #temp_all_dates having count(startdate) = 1