Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 select statement are not retrives the records from

Author  Topic 

pmotewar
Yak Posting Veteran

62 Posts

Posted - 2010-08-20 : 05:41:06
Hi all,

i have 1 table having 30 rows.

when i execute select statement like

select * from transaction_temp

it will not retrive the records.

but if i execute it with top statement like

select top 20 * from transaction_temp

it will give me 20 records.

but if if execute with top 21

select top 21 * from transaction_temp

it wont give me result.

please suggest the solution. i am newbee in T-sql.

Pankaj

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-08-20 : 06:03:21
What do you mean 'it won't give result'? It returns no records? It throws an error? something else?

--
Gail Shaw
SQL Server MVP
Go to Top of Page

pmotewar
Yak Posting Veteran

62 Posts

Posted - 2010-08-20 : 06:10:48
quote:
Originally posted by GilaMonster

What do you mean 'it won't give result'? It returns no records? It throws an error? something else?

--
Gail Shaw
SQL Server MVP



it gives timeout expired error.

Pankaj
Go to Top of Page

GilaMonster
Master Smack Fu Yak Hacker

4507 Posts

Posted - 2010-08-20 : 06:24:14
Sounds like there's a lock on one of the rows. Is there a DBA there? Someone who knows how to check for locks and blocking?

--
Gail Shaw
SQL Server MVP
Go to Top of Page

pmotewar
Yak Posting Veteran

62 Posts

Posted - 2010-08-20 : 06:53:59
quote:
Originally posted by GilaMonster

Sounds like there's a lock on one of the rows. Is there a DBA there? Someone who knows how to check for locks and blocking?

--
Gail Shaw
SQL Server MVP



Unfortunately our DBA is on leave. can you please provide me query to check lock n blocking ??

Pankaj
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2010-08-20 : 07:19:15
Here is a start
SELECT	OBJECT_ID('transaction_temp') AS ObjID

EXEC master..sp_lock
Now look for a record with same ObjID as first value.


N 56°04'39.26"
E 12°55'05.63"
Go to Top of Page
   

- Advertisement -