Main Page | Report this Page
.NET DotNet Forum Index  »  VB.NET Forum (Visual Basic .NET)  »  Help for this pls stored procedure
Page 1 of 1    

Help for this pls stored procedure

Author Message
sebastien1101
Posted: Mon Apr 17, 2006 3:51 am
Guest
In my stored procedure i have :
EXECUTE ('select ' + @TotalRecords + ' = count(*) from clients')

It doesn't work!
and i don't know how i can ?
 
Michel Posseth [MCP]
Posted: Mon Apr 17, 2006 4:33 am
Guest
No this doesn`t work :-)

as with a execute statement you are now creating the following string to
execute 'select = count(*) from clients'
so it will result in an error

if it is so that the stored procedure itself should return this value then

SELECT COUNT(*) FROM clients should do the trick

if it is your intention that the variabel @TotalRecords should hold the
value then

SELECT @TotalRecords=COUNT(*) FROM clients

wil do what you want

you may also perform anny select query and then read the @@ROWCOUNT value

HTH

Michel Posseth [MCP]



"sebastien1101" <sebastien1101@hotmail.fr> schreef in bericht
news:1145267519.630906.189410@v46g2000cwv.googlegroups.com...
Quote:
In my stored procedure i have :
EXECUTE ('select ' + @TotalRecords + ' = count(*) from clients')

It doesn't work!
and i don't know how i can ?
 
 
Page 1 of 1    
All times are GMT - 5 Hours
The time now is Sat Dec 05, 2009 8:14 pm