New answers tagged

1

Yes, something like the below. SELECT * FROM DataTable WHERE (@SearchField = 'CreateDate' AND CreateDate BETWEEN @StartDate AND @EndDate) OR (@SearchField = 'ModifyDate' AND ModifyDate BETWEEN @StartDate AND @EndDate) Or, to use the example WHERE clauses you specified, how about the below? SELECT * FROM DataTable WHERE ( @ReportType = 1 ...


0

It depends but more than likely yes (with some potential performance issues due to different query plans being cached). Can you give a little more detail on what exactly the type of values are entered in the parameter? Are the 3 values all going to be dates, is the parameter itself a string value that you need to convert to the appropriate type, and is ...


2

Community Wiki answer generated from a comment on the question by Martin Smith There is an active Connect item (submitted by Erland Sommarskog) for this: Relax restriction that table parameters must be readonly when SPs call each other The only response by Microsoft so far says (emphasis added): Thanks for the feedback on this. We have received ...



Top 50 recent answers are included