Click here to Skip to main content
15,887,350 members
Home / Discussions / Database
   

Database

 
QuestionProblem with working SQL Server SAVE POINTS in Transactions. Pin
farhan197627-Oct-05 20:11
farhan197627-Oct-05 20:11 
QuestionTriggers and transaction context. Pin
devvvy27-Oct-05 6:15
devvvy27-Oct-05 6:15 
AnswerRe: Triggers and transaction context. Pin
Farhan Noor Qureshi27-Oct-05 9:21
Farhan Noor Qureshi27-Oct-05 9:21 
GeneralRe: Triggers and transaction context. Pin
devvvy27-Oct-05 13:49
devvvy27-Oct-05 13:49 
QuestionDatabase 'foodmart 2000' does not exist Pin
kuldeep_kumar27-Oct-05 5:25
kuldeep_kumar27-Oct-05 5:25 
QuestionDynamic procedures, are they possible? Pin
FruitBatInShades27-Oct-05 3:59
FruitBatInShades27-Oct-05 3:59 
AnswerRe: Dynamic procedures, are they possible? Pin
Colin Angus Mackay27-Oct-05 6:31
Colin Angus Mackay27-Oct-05 6:31 
AnswerRe: Dynamic procedures, are they possible? Pin
codet28-Oct-05 16:28
codet28-Oct-05 16:28 
You can't use IF or CASE statements in a WHERE clause with SQL Server 2000.

I would follow the advice posted below and store the query contents in a varchar, @SQL_STATEMENT. When you get the the WHERE clause, you can concatenate the onto the WHERE clause your criterion. To get around having to include logic to decide wether to include 'AND', build the query with ... WHERE 1=1. Then concatenate 'AND X = @X' IF @X > 0.

After this, you can do an exec(@SQL_STATEMENT). I don't see anything wrong with this as the query optimizer will still be able to optimize the query. THe only thing you have to be careful of with these is that the calling code doesn't allow any SQL to make it into the dynamic stored proc. Asp.net will do this for you unless you turn it off. It's an @Page directive called ValidateRequest I think...

Good luck
QuestionProblems inserting data in database with datagrid Pin
wappi_berlin27-Oct-05 1:44
wappi_berlin27-Oct-05 1:44 
QuestionExcluding some fields from a table in a datagrid Pin
odrap26-Oct-05 0:24
odrap26-Oct-05 0:24 
AnswerRe: Excluding some fields from a table in a datagrid Pin
Edbert P26-Oct-05 12:50
Edbert P26-Oct-05 12:50 
QuestionInsert Data via Stored procedure by ado.net Pin
thedom225-Oct-05 23:33
thedom225-Oct-05 23:33 
AnswerRe: Insert Data via Stored procedure by ado.net Pin
Edbert P26-Oct-05 12:52
Edbert P26-Oct-05 12:52 
GeneralRe: Insert Data via Stored procedure by ado.net Pin
thedom226-Oct-05 13:16
thedom226-Oct-05 13:16 
QuestionCreating a Microsoft Acces "Module" in a MDB-file by Code from C++ Pin
Uwe Keim25-Oct-05 20:08
sitebuilderUwe Keim25-Oct-05 20:08 
AnswerRe: Creating a Microsoft Acces "Module" in a MDB-file by Code from C++ Pin
Uwe Keim25-Oct-05 20:33
sitebuilderUwe Keim25-Oct-05 20:33 
QuestionQuery Tables Fiels name and type Pin
icDavid25-Oct-05 13:12
icDavid25-Oct-05 13:12 
AnswerRe: Query Tables Fiels name and type Pin
icDavid25-Oct-05 14:27
icDavid25-Oct-05 14:27 
AnswerRe: Query Tables Fiels name and type Pin
Farhan Noor Qureshi25-Oct-05 17:59
Farhan Noor Qureshi25-Oct-05 17:59 
QuestionAggregate queries and functions Pin
mjackson1125-Oct-05 10:53
mjackson1125-Oct-05 10:53 
AnswerRe: Aggregate queries and functions Pin
Farhan Noor Qureshi25-Oct-05 12:38
Farhan Noor Qureshi25-Oct-05 12:38 
GeneralRe: Aggregate queries and functions Pin
mjackson1125-Oct-05 18:25
mjackson1125-Oct-05 18:25 
GeneralRe: Aggregate queries and functions Pin
Farhan Noor Qureshi26-Oct-05 11:35
Farhan Noor Qureshi26-Oct-05 11:35 
QuestionHiiSQL Server Database Name Pin
utsav_verma24-Oct-05 19:48
utsav_verma24-Oct-05 19:48 
AnswerRe: HiiSQL Server Database Name Pin
Colin Angus Mackay24-Oct-05 20:13
Colin Angus Mackay24-Oct-05 20:13 

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.