SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 Database Design and Application Architecture
 How to check first one record is in Table
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Arunavally
Yak Posting Veteran

India
58 Posts

Posted - 10/24/2013 :  07:03:10  Show Profile  Reply with Quote
Hai,

I want to check if first record is in Table or not.

Kindly help me.
Thanks in Advance

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 10/24/2013 :  08:31:17  Show Profile  Reply with Quote
Define what do you mean "First record". SQL doesnt have any concept of First or Last unless you specify order by means of ORDER BY clause.

If you attempt is to see if table has any rows use this


IF EXISTS (SELECT 1 FROM tableName)
 ...your code


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

Arunavally
Yak Posting Veteran

India
58 Posts

Posted - 10/24/2013 :  09:20:05  Show Profile  Reply with Quote
Thank you. I wan to chk table have any records or not?
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 10/24/2013 :  11:44:12  Show Profile  Reply with Quote
ok...then what i gave you would be enough.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page

Arunavally
Yak Posting Veteran

India
58 Posts

Posted - 10/25/2013 :  00:33:25  Show Profile  Reply with Quote
I used
If exists (select 1 from table)

its wrk as my wish
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52317 Posts

Posted - 10/25/2013 :  03:00:05  Show Profile  Reply with Quote
cool

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/
https://www.facebook.com/VmBlogs
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000