Click here to Skip to main content
15,905,563 members
Home / Discussions / Database
   

Database

 
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 
GeneralRe: Need help with "order by", "group by" Pin
Arjan Einbu7-Aug-03 8:11
Arjan Einbu7-Aug-03 8:11 
GeneralRe: Need help with "order by", "group by" Pin
lnong7-Aug-03 8:41
lnong7-Aug-03 8:41 
GeneralRe: Need help with "order by", "group by" Pin
Arjan Einbu7-Aug-03 9:29
Arjan Einbu7-Aug-03 9:29 
GeneralPerl script to sql server2000 conversion Pin
puneet trehan6-Aug-03 22:15
puneet trehan6-Aug-03 22:15 
GeneralJoining tables Pin
totig6-Aug-03 12:32
totig6-Aug-03 12:32 
GeneralRe: Joining tables Pin
Rein Hillmann6-Aug-03 21:55
Rein Hillmann6-Aug-03 21:55 
GeneralHowto:? obtain all unique values in a column from a .net datatable Pin
pg82906-Aug-03 10:50
pg82906-Aug-03 10:50 

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.