Click here to Skip to main content
15,900,258 members
Home / Discussions / Database
   

Database

 
GeneralRe: How can I Inserting to a table Pin
Colin Angus Mackay18-Mar-07 11:58
Colin Angus Mackay18-Mar-07 11:58 
Questiona problem with sql server 2005 in window vista ! Pin
mrkeivan17-Mar-07 2:58
mrkeivan17-Mar-07 2:58 
QuestionExporting data from sqlserver to Excel Pin
Tech_spidy17-Mar-07 2:11
Tech_spidy17-Mar-07 2:11 
AnswerRe: Exporting data from sqlserver to Excel Pin
kubben17-Mar-07 2:20
kubben17-Mar-07 2:20 
GeneralRe: Exporting data from sqlserver to Excel Pin
Tech_spidy17-Mar-07 3:50
Tech_spidy17-Mar-07 3:50 
QuestionCan i Copy paste sql table Pin
nikhil123417-Mar-07 0:21
nikhil123417-Mar-07 0:21 
AnswerRe: Can i Copy paste sql table Pin
mghiassi17-Mar-07 7:00
mghiassi17-Mar-07 7:00 
GeneralRe: Can i Copy paste sql table Pin
Ziyad Mohammad18-Mar-07 20:52
Ziyad Mohammad18-Mar-07 20:52 
GeneralRe: Can i Copy paste sql table Pin
mghiassi19-Mar-07 8:30
mghiassi19-Mar-07 8:30 
Questionstored procedure vs sql query Pin
Tauseef A16-Mar-07 16:07
Tauseef A16-Mar-07 16:07 
AnswerRe: stored procedure vs sql query Pin
kubben16-Mar-07 16:57
kubben16-Mar-07 16:57 
Questionmaster data - 'These columns don't currently have unique values' Pin
freeisgood16-Mar-07 13:11
freeisgood16-Mar-07 13:11 
AnswerRe: master data - 'These columns don't currently have unique values' Pin
PlayByTheRules16-Mar-07 23:58
PlayByTheRules16-Mar-07 23:58 
QuestionReturn output parameter and dataset Pin
Ridge Howison16-Mar-07 11:09
Ridge Howison16-Mar-07 11:09 
AnswerRe: Return output parameter and dataset Pin
kubben16-Mar-07 12:47
kubben16-Mar-07 12:47 
QuestionAutomatically generating scripts? [modified] Pin
LongRange.Shooter16-Mar-07 7:00
LongRange.Shooter16-Mar-07 7:00 
AnswerRe: Automatically generating scripts? Pin
Mark J. Miller19-Mar-07 5:57
Mark J. Miller19-Mar-07 5:57 
GeneralRe: Automatically generating scripts? Pin
LongRange.Shooter20-Mar-07 6:27
LongRange.Shooter20-Mar-07 6:27 
QuestionMultiple Instances - SQLSERVER Pin
clint198216-Mar-07 5:00
clint198216-Mar-07 5:00 
AnswerRe: Multiple Instances - SQLSERVER Pin
Mike Dimmick16-Mar-07 6:22
Mike Dimmick16-Mar-07 6:22 
GeneralRe: Multiple Instances - SQLSERVER Pin
clint198216-Mar-07 8:26
clint198216-Mar-07 8:26 
Questionstored procedures Vs dynamic SQL Pin
digsy_16-Mar-07 3:40
digsy_16-Mar-07 3:40 
I have a question about stored procedures Vs dynamic SQL.

I'm a noob but from the googling I've done this seems to be a hot topic so I dont want to start an arguement but I'm stuck.

The website I am working on has a data access layer that takes in a SP name & parameters. It runs the SP and returns the resulting data to the page that requested it.

This is easy & quick to maintain for me.

However, my users want to be able to search the customer using search criteria parameters that can be different each time. By that I mean they want to be able to search for customers using whatever data they have. Sometimes they will have a last name, other times a last name & birth date, sometimes a phone number and a first name.

This doesnt seem to lend itself to a SP - the parameters change each time so the solutions seem to be:

1. A SP that has every criteria in it and use LIKE '%%' when the customer doesnt use one of them
2. Have the data access layer dynamically build the required SQL and then insert it into the SP somehow. (Which sorta kinda sounds like SQL injection)
3. Build an SP for each group of search criteria (Name, DOB, Phone numbers, TIN) and then only allow the users to use one search criteria group at a time.

Neither solution sounds that great to me. (There may be others but like I say I'm a noob)

Which leads me to think that maybe in this case I should use Dynamic SQL - e.g. have the data acccess layer create the SQL statement and then execute it against the database without using an SP.

But then that breaks my rule of only using SP (which I originally created cos I thought SP ran quicker but then I read that according to some guys at MS that dynamic SQL runs as quickly as SP in the .Net environment) so now I'm confused.
AnswerRe: stored procedures Vs dynamic SQL Pin
Pete O'Hanlon16-Mar-07 3:44
mvePete O'Hanlon16-Mar-07 3:44 
GeneralRe: stored procedures Vs dynamic SQL Pin
digsy_16-Mar-07 3:56
digsy_16-Mar-07 3:56 
GeneralRe: stored procedures Vs dynamic SQL Pin
Pete O'Hanlon16-Mar-07 4:09
mvePete O'Hanlon16-Mar-07 4:09 

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.