Click here to Skip to main content
16,004,969 members
Home / Discussions / Database
   

Database

 
GeneralRe: Stupid INSERT question for PL-SQL Pin
Nostrom016-Dec-08 10:35
Nostrom016-Dec-08 10:35 
GeneralRe: Stupid INSERT question for PL-SQL Pin
Wendelius16-Dec-08 10:47
mentorWendelius16-Dec-08 10:47 
GeneralRe: Stupid INSERT question for PL-SQL Pin
Nostrom016-Dec-08 11:20
Nostrom016-Dec-08 11:20 
GeneralRe: Stupid INSERT question for PL-SQL Pin
Wendelius16-Dec-08 11:27
mentorWendelius16-Dec-08 11:27 
GeneralRe: Stupid INSERT question for PL-SQL Pin
Nostrom016-Dec-08 11:53
Nostrom016-Dec-08 11:53 
GeneralRe: Stupid INSERT question for PL-SQL Pin
Wendelius16-Dec-08 12:05
mentorWendelius16-Dec-08 12:05 
AnswerRe: Stupid INSERT question for PL-SQL Pin
Chris Meech16-Dec-08 10:56
Chris Meech16-Dec-08 10:56 
QuestionSelect After Update Pin
Sunset Towers16-Dec-08 3:54
Sunset Towers16-Dec-08 3:54 
I am attempt to lock a record and at the same time retrieve that record.
I am doing this from C# and the string is created using string.format, and while I'm certain the first part of this will work with out a problem. I need to select the record that I'm updating here and I wanted to do it in one statement.

So far I have

WITH GetOneRecord AS
(
     SELECT     TOP (1) RecordID
     FROM         [{0}]
     WHERE     (Completed = 'false') AND (CheckedOut = 'false')
)
UPDATE [{0}]
     SET CheckedOut = 'true', CheckedOutBy = '{1}', CheckedOutDateTime = {2}
     WHERE (RecordID = GetOneRecord.RecordID)


{0} is a dynamic table name.
{1} is the user who is checking out the record.
{2} is the time the record was checked out.

Can I just add the following after the UPDATE clause and get just the SELECT record
below returned. I mean is there a way to hide the fact that the UPDATE record is going to try and return integer so that only the SELECT clause below is going to return data.
SELECT *
FROM [{0}]
WHERE CheckedOutBy = '{1}'

I'm wanting it to possibly return multiple rows incase something happened and a program has to be restarted or the server goes down. Then I can have the program release the older lock in another command.
AnswerRe: Select After Update Pin
Sunset Towers16-Dec-08 5:17
Sunset Towers16-Dec-08 5:17 
GeneralRe: Select After Update [modified] Pin
Wendelius16-Dec-08 6:04
mentorWendelius16-Dec-08 6:04 
GeneralRe: Select After Update [modified] Pin
Syed Mehroz Alam16-Dec-08 7:24
Syed Mehroz Alam16-Dec-08 7:24 
GeneralRe: Select After Update Pin
Wendelius16-Dec-08 8:14
mentorWendelius16-Dec-08 8:14 
GeneralRe: Select After Update Pin
Syed Mehroz Alam16-Dec-08 18:02
Syed Mehroz Alam16-Dec-08 18:02 
GeneralRe: Select After Update Pin
Wendelius17-Dec-08 6:02
mentorWendelius17-Dec-08 6:02 
QuestionHow can i extract numeric values from varchar Pin
snehasish15-Dec-08 19:57
snehasish15-Dec-08 19:57 
AnswerRe: How can i extract numeric values from varchar Pin
Blue_Boy15-Dec-08 23:11
Blue_Boy15-Dec-08 23:11 
GeneralRe: How can i extract numeric values from varchar Pin
snehasish16-Dec-08 2:26
snehasish16-Dec-08 2:26 
GeneralRe: How can i extract numeric values from varchar Pin
Blue_Boy16-Dec-08 5:18
Blue_Boy16-Dec-08 5:18 
GeneralRe: How can i extract numeric values from varchar Pin
snehasish16-Dec-08 8:31
snehasish16-Dec-08 8:31 
GeneralRe: How can i extract numeric values from varchar Pin
Blue_Boy16-Dec-08 11:12
Blue_Boy16-Dec-08 11:12 
QuestionSplit the Delimiters Pin
cbe_pav15-Dec-08 18:39
cbe_pav15-Dec-08 18:39 
AnswerRe: Split the Delimiters Pin
Ashfield15-Dec-08 21:05
Ashfield15-Dec-08 21:05 
QuestionGet the following query down to one execution Pin
Sunset Towers15-Dec-08 11:03
Sunset Towers15-Dec-08 11:03 
AnswerRe: Get the following query down to one execution Pin
Wendelius15-Dec-08 11:16
mentorWendelius15-Dec-08 11:16 
GeneralRe: Get the following query down to one execution Pin
Sunset Towers15-Dec-08 12:00
Sunset Towers15-Dec-08 12:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.