Click here to Skip to main content
16,009,156 members
Home / Discussions / Database
   

Database

 
Generalprint Pin
deanoA11-Aug-03 16:24
deanoA11-Aug-03 16:24 
GeneralDatabase question Pin
Grindorin11-Aug-03 14:23
Grindorin11-Aug-03 14:23 
GeneralRe: Database question Pin
Arjan Einbu12-Aug-03 10:23
Arjan Einbu12-Aug-03 10:23 
GeneralRe: Database question Pin
Grindorin13-Aug-03 14:18
Grindorin13-Aug-03 14:18 
GeneralQuestion: using multi-thread in ADO.Net & C# Pin
yyf11-Aug-03 9:14
yyf11-Aug-03 9:14 
GeneralRe: Question: using multi-thread in ADO.Net & C# Pin
Mike Dimmick11-Aug-03 11:23
Mike Dimmick11-Aug-03 11:23 
GeneralDatabase Pin
Capper11-Aug-03 8:05
Capper11-Aug-03 8:05 
QuestionHow do i access different databases Pin
Venkatraman11-Aug-03 2:38
Venkatraman11-Aug-03 2:38 
AnswerRe: How do i access different databases Pin
Mike Dimmick11-Aug-03 3:59
Mike Dimmick11-Aug-03 3:59 
GeneralDeleted RowState and the XmlDataDocument... Pin
b33rdy11-Aug-03 0:31
b33rdy11-Aug-03 0:31 
Generalautonumbering index Pin
Jerome Conus10-Aug-03 19:44
Jerome Conus10-Aug-03 19:44 
GeneralRe: autonumbering index Pin
ZoogieZork10-Aug-03 19:54
ZoogieZork10-Aug-03 19:54 
GeneralRe: autonumbering index Pin
Jerome Conus10-Aug-03 19:56
Jerome Conus10-Aug-03 19:56 
GeneralRe: autonumbering index Pin
ZoogieZork10-Aug-03 20:15
ZoogieZork10-Aug-03 20:15 
GeneralSQL SPs With Conditionals Based on Parameters Pin
kcs9-Aug-03 17:44
professionalkcs9-Aug-03 17:44 
These may be a stupid questions, but I have not been able to figure it out except for having a SPs that are slightly different.

Is it possible in a MS-SQL Server T-SQL Stored Procedure to do something like this pseudo code:

SELECT SUM(Amount) FROM Sales
if @StoreID > 0
then WHERE StoreID = @StoreID
else WHERE StoreID > 0


And also something like this, where @StoreID is a comma delimited list of StoreIDs

SELECT SUM(Amount) FROM Sales
if CAST(@StoreID as integer) > 0
then WHERE StoreID = @StoreID
else WHERE StoreID IN (@StoreID)


Note: My SELECT statements are much (much) more complicated than this. These where minimized for clarity.

Maybe I guess the real question is "even if I can do this, should I"? I am trying to minimize the business logic and the number of different SPs I have.

Thanks in advance,

Konstantine
GeneralRe: SQL SPs With Conditionals Based on Parameters Pin
Mike Dimmick11-Aug-03 4:52
Mike Dimmick11-Aug-03 4:52 
GeneralRe: SQL SPs With Conditionals Based on Parameters Pin
kcs12-Aug-03 9:02
professionalkcs12-Aug-03 9:02 
GeneralSQL SUM() Pin
Anonymous9-Aug-03 8:42
Anonymous9-Aug-03 8:42 
GeneralRe: SQL SUM() Pin
Not Active9-Aug-03 13:28
mentorNot Active9-Aug-03 13:28 
GeneralRe: SQL SUM() Pin
Arjan Einbu10-Aug-03 10:10
Arjan Einbu10-Aug-03 10:10 
GeneralDataView Pin
Jubal7-Aug-03 8:13
Jubal7-Aug-03 8:13 
GeneralLinking One Server To Another Pin
qmuffs7-Aug-03 7:02
qmuffs7-Aug-03 7:02 
GeneralRe: Linking One Server To Another Pin
Alexander Kojevnikov7-Aug-03 23:58
Alexander Kojevnikov7-Aug-03 23:58 
GeneralRe: Linking One Server To Another Pin
qmuffs8-Aug-03 8:46
qmuffs8-Aug-03 8:46 
GeneralNeed help with "order by", "group by" Pin
lnong7-Aug-03 1:44
lnong7-Aug-03 1:44 

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.