Click here to Skip to main content
15,898,222 members
Home / Discussions / Database
   

Database

 
AnswerRe: Select Query Pin
Girish4811-Apr-07 3:34
Girish4811-Apr-07 3:34 
AnswerRe: Select Query Pin
Krish - KP6-Apr-07 4:42
Krish - KP6-Apr-07 4:42 
QuestionBest practice in large tables Pin
Nader Elshehabi31-Mar-07 10:10
Nader Elshehabi31-Mar-07 10:10 
AnswerRe: Best practice in large tables Pin
Colin Angus Mackay31-Mar-07 10:23
Colin Angus Mackay31-Mar-07 10:23 
GeneralRe: Best practice in large tables Pin
Nader Elshehabi31-Mar-07 10:36
Nader Elshehabi31-Mar-07 10:36 
AnswerRe: Best practice in large tables Pin
kubben31-Mar-07 14:41
kubben31-Mar-07 14:41 
GeneralRe: Best practice in large tables Pin
Nader Elshehabi31-Mar-07 21:58
Nader Elshehabi31-Mar-07 21:58 
QuestionSQL Stored Procedure Column Pin
Lea Hayes31-Mar-07 9:24
Lea Hayes31-Mar-07 9:24 
Hi,

I am using MSSQL2005 and am having difficulties understanding how to create a stored procedure which first verfies data is found, and then if so processes that data.

ALTER PROCEDURE dbo.PostNews
@Subject VARCHAR(255),
@Body TEXT
AS
/* Has news already been posted within the last 10 minutes? */
IF EXISTS(SELECT TOP 1 DATEDIFF(MINUTE, tableNews.CreateDate, GETDATE()) AS MinuteDiff FROM tableNews WHERE tableNews.Subject=@Subject) BEGIN

/** THIS DOES NOT WORK **/
IF(MinuteDiff <= 10) RETURN 1;
END

/* Post news entry. */

RETURN 0;
RETURN


If possible it would be great to find out how you guys attempt these types of SQL statements. What could I do to resolve the above issue, if the result is found I want to return 1, otherwise return 0 once the news posting has been added.

Many thanks,
Lea Hayes
AnswerRe: SQL Stored Procedure Column Pin
Colin Angus Mackay31-Mar-07 10:09
Colin Angus Mackay31-Mar-07 10:09 
GeneralRe: SQL Stored Procedure Column Pin
Lea Hayes31-Mar-07 10:17
Lea Hayes31-Mar-07 10:17 
GeneralRe: SQL Stored Procedure Column Pin
Colin Angus Mackay31-Mar-07 10:24
Colin Angus Mackay31-Mar-07 10:24 
Questionself join Pin
zizu9096@gmail.com31-Mar-07 5:31
zizu9096@gmail.com31-Mar-07 5:31 
AnswerRe: self join Pin
Colin Angus Mackay31-Mar-07 10:13
Colin Angus Mackay31-Mar-07 10:13 
AnswerRe: self join Pin
DQNOK2-Apr-07 6:55
professionalDQNOK2-Apr-07 6:55 
QuestionHow to calll Oracle stored procedures from Microsoft Reporting Services Pin
maskor ma31-Mar-07 1:36
maskor ma31-Mar-07 1:36 
QuestionError: DataBinding: 'System.Data.DataRowView' [modified] Pin
nothingbutcat30-Mar-07 16:25
nothingbutcat30-Mar-07 16:25 
QuestionComplex Select Query Pin
Girish48130-Mar-07 7:48
Girish48130-Mar-07 7:48 
AnswerRe: Complex Select Query Pin
DQNOK30-Mar-07 8:12
professionalDQNOK30-Mar-07 8:12 
GeneralRe: Complex Select Query Pin
Girish48130-Mar-07 8:28
Girish48130-Mar-07 8:28 
GeneralRe: Complex Select Query Pin
DQNOK30-Mar-07 8:39
professionalDQNOK30-Mar-07 8:39 
GeneralRe: Complex Select Query Pin
Jerry Hammond30-Mar-07 15:16
Jerry Hammond30-Mar-07 15:16 
GeneralRe: Complex Select Query Pin
DQNOK30-Mar-07 12:49
professionalDQNOK30-Mar-07 12:49 
GeneralRe: Complex Select Query Pin
Girish48130-Mar-07 21:23
Girish48130-Mar-07 21:23 
AnswerRe: Complex Select Query - I think that might help [modified] Pin
The_Server30-May-07 22:27
The_Server30-May-07 22:27 
QuestionSQL IDE Recommendation Pin
mobius11100130-Mar-07 5:28
mobius11100130-Mar-07 5:28 

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.