Please start any new threads on our new
site at http://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Our new SQL Server Forums are live!
Come on over! We've restricted the ability to create new threads on these forums.
Aged Yak Warrior
SELECT COUNT(*) as cnt FROM Table
SELECT (*) FROM Table
quote:Originally posted by sirmiltI need to create a simple stored procedure to set a value of 0 if there are no records in a table. This code:SELECT (*) FROM TableIn Visual Basic because the first row of a table with no data is filled with null values it throws an error completed. What I need to do is determine if there are records or not.MiltMilt
Very Important crosS Applying yaK Herder
SELECT COUNT(*) AS cnt FROM table
WHERE NOT EXISTS (SELECT 1 FROM table)
quote:Originally posted by sirmiltI don't need two rows, all I wanted was the actual nubber of records that have been entered.Milt
quote:Originally posted by sirmiltThanks to all of you for the help.If there are no records all I need is a 0. The while I don't understand the last line of the code, the code posted by visakh16 seems to work fine.Milt