Click here to Skip to main content
16,011,743 members
Home / Discussions / Database
   

Database

 
AnswerRe: Error In Query: Pin
Colin Angus Mackay6-Feb-07 22:21
Colin Angus Mackay6-Feb-07 22:21 
AnswerRe: Error In Query: Pin
Vsree7-Feb-07 0:05
Vsree7-Feb-07 0:05 
QuestionRetrieving data from multiple databases Pin
Malayil alex6-Feb-07 17:56
Malayil alex6-Feb-07 17:56 
AnswerRe: Retrieving data from multiple databases Pin
gauthee6-Feb-07 18:53
gauthee6-Feb-07 18:53 
QuestionFilling a typed dataset Pin
steve_rm6-Feb-07 16:02
steve_rm6-Feb-07 16:02 
AnswerRe: Filling a typed dataset Pin
M.H.1.2.37-Feb-07 17:50
M.H.1.2.37-Feb-07 17:50 
QuestionUsing parameter on Query condition not working Pin
firestoper6-Feb-07 15:46
firestoper6-Feb-07 15:46 
AnswerRe: Using parameter on Query condition not working Pin
M.H.1.2.36-Feb-07 16:49
M.H.1.2.36-Feb-07 16:49 
The easiest way to make the column in the where clause dynamic is to build the query in the procedure then execute the sql code. example from article:

Article on dynamic sql [^]
use Northwind
go
declare @RECCNT int
declare @ORDID varchar(10)
declare @CMD Nvarchar(100)
set @ORDID = 10436
SET @CMD = 'SELECT @RECORDCNT=count(*) from [Orders]' +
' where OrderId < @ORDERID'
print @CMD
exec sp_executesql @CMD,
N'@RECORDCNT int out, @ORDERID int',
@RECCNT out,
@ORDID
print 'The number of records that have an OrderId' +
' greater than ' + @ORDID + ' is ' +
cast(@RECCNT as char(5))

Another idea is if you only have a couple possible columns you could do something like this

Select *
From table
where column1 = isnull(@Column1Value, column1)
and column2 = isnull(@Column2Value, column2)

This might not perform well on a large table
GeneralRe: Using parameter on Query condition not working Pin
firestoper6-Feb-07 18:17
firestoper6-Feb-07 18:17 
AnswerRe: Using parameter on Query condition not working Pin
gauthee6-Feb-07 17:29
gauthee6-Feb-07 17:29 
GeneralRe: Using parameter on Query condition not working Pin
firestoper11-Feb-07 21:16
firestoper11-Feb-07 21:16 
QuestionQuery Help Pin
Hulicat6-Feb-07 15:11
Hulicat6-Feb-07 15:11 
AnswerRe: Query Help Pin
M.H.1.2.36-Feb-07 16:58
M.H.1.2.36-Feb-07 16:58 
GeneralRe: Query Help Pin
Hulicat6-Feb-07 17:25
Hulicat6-Feb-07 17:25 
QuestionSQL parameters and datatypes Pin
sojumonk6-Feb-07 14:16
sojumonk6-Feb-07 14:16 
AnswerRe: SQL parameters and datatypes Pin
Kschuler7-Feb-07 10:37
Kschuler7-Feb-07 10:37 
QuestionHelp required in query formation Pin
www.Developerof.NET6-Feb-07 5:50
www.Developerof.NET6-Feb-07 5:50 
AnswerRe: Help required in query formation Pin
andyharman6-Feb-07 7:54
professionalandyharman6-Feb-07 7:54 
QuestionProblem connecting to remote SQL Express 2005 Pin
Joe Smith IX6-Feb-07 5:02
Joe Smith IX6-Feb-07 5:02 
AnswerRe: Problem connecting to remote SQL Express 2005 Pin
Rob Graham6-Feb-07 5:19
Rob Graham6-Feb-07 5:19 
AnswerRe: Problem connecting to remote SQL Express 2005 Pin
Mark Salsbery6-Feb-07 16:46
Mark Salsbery6-Feb-07 16:46 
AnswerRe: Problem connecting to remote SQL Express 2005 Pin
Joe Smith IX15-Feb-07 2:02
Joe Smith IX15-Feb-07 2:02 
QuestionError : &quot;Operation must use an updateable query&quot; Pin
RedhaDev6-Feb-07 1:42
RedhaDev6-Feb-07 1:42 
AnswerRe: Error : "Operation must use an updateable query" Pin
Bassam Saoud6-Feb-07 1:45
Bassam Saoud6-Feb-07 1:45 
QuestionHelp required in joins Pin
www.Developerof.NET6-Feb-07 1:40
www.Developerof.NET6-Feb-07 1:40 

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.