Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Geek Culture / SQL SPROC help for the retarded (me)

Author
Message
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 14th May 2004 21:49
Now I know why I leave the SQL stuff to my partner

I have: SELECT * FROM TBL_MYTABLE WHERE Processed=0

I need to just get the FIRST record that has Processed=0. I tried TOP keyword but I may have the syntax wrong...

anyone sql friendly?
Thanks


* DBP_NETLIB_v1 - VB.NET PLUGIN FOR DBP * Click Logo
Richard Davey
Retired Moderator
22
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 14th May 2004 21:58
MS SQL I assume?

Should just be as simple as:

SELECT TOP 1 * FROM table WHERE ...

With our species on the edge of extermination,
with no prospect but a horrible death,
we actually played games.
Richard Davey
Retired Moderator
22
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 14th May 2004 22:00
Oh and via a SP:

declare @top_val int
set @top_val = 1
set rowcount @top_val
select * from MyTable Order by DateColumn
set rowcount 0

(but you could pass in the top_val to the SP)

With our species on the edge of extermination,
with no prospect but a horrible death,
we actually played games.
Lord Ozzum
20
Years of Service
User Offline
Joined: 29th Oct 2003
Location: Beyond the Realms of Death
Posted: 14th May 2004 22:03
edit j/k around

You forgot to read your fortune cookie. It says you're sh!t out of luck.
Welcome to the Electric Funeral!!!
CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 14th May 2004 22:16 Edited at: 14th May 2004 22:21
Thanks Rich.

EDIT: Just tested, all is well. I had "..select top 1 from.." instead of "..select top 1 * from.."

heh.



* DBP_NETLIB_v1 - VB.NET PLUGIN FOR DBP * Click Logo

Login to post a reply

Server time is: 2024-09-22 00:15:48
Your offset time is: 2024-09-22 00:15:48