Click here to Skip to main content
15,912,021 members
Home / Discussions / Database
   

Database

 
AnswerRe: how to get name of all tables in msaccess database Pin
rwestgraham28-Mar-05 18:25
rwestgraham28-Mar-05 18:25 
GeneralDataRelation question Pin
IlanTal26-Mar-05 21:36
IlanTal26-Mar-05 21:36 
GeneralRe: DataRelation question Pin
Scott Serl28-Mar-05 10:06
Scott Serl28-Mar-05 10:06 
GeneralRe: DataRelation question Pin
IlanTal28-Mar-05 18:38
IlanTal28-Mar-05 18:38 
GeneralRe: DataRelation question Pin
Scott Serl29-Mar-05 6:44
Scott Serl29-Mar-05 6:44 
GeneralRe: DataRelation question Pin
IlanTal29-Mar-05 7:10
IlanTal29-Mar-05 7:10 
GeneralQuestion about SELECT Pin
_J_26-Mar-05 5:57
_J_26-Mar-05 5:57 
GeneralRe: Question about SELECT Pin
turbochimp26-Mar-05 11:35
turbochimp26-Mar-05 11:35 
You can use conditional logic in your procedure, but you may want to consider why you've got empty parameters coming into a stored procedure - there are valid reasons, but it's nice to try to avoid it. You can also set defaults on parameters to sidestep having to use conditional logic in some cases.

Example:
-- These variables would typically be input params<br />
declare @param1 nvarchar(10)<br />
declare @param2 nvarchar(10)<br />
set @param2 = 'Value1'<br />
<br />
-- These variables just hold the length of the params<br />
declare @lenP1 int<br />
declare @lenP2 int<br />
set @lenP1 = len(@param1)<br />
set @lenP2 = len(@param2)<br />
<br />
-- Outputs the state of the params<br />
if @lenP1 > 0 and @lenP2 > 0<br />
	select 'Both parameters were provided.'<br />
else if @lenP1 > 0 and (@lenP2 = 0 or @lenP2 is null)<br />
	select 'The first parameter was provided but the second was omitted'<br />
else<br />
        -- This statement will be executed.<br />
	select 'The second parameter was provided but the first was omitted'



The most exciting phrase to hear in science, the one that heralds the most discoveries, is not 'Eureka!' ('I found it!') but 'That's funny...’

GeneralRe: Question about SELECT Pin
Colin Angus Mackay29-Mar-05 1:03
Colin Angus Mackay29-Mar-05 1:03 
GeneralRe: Question about SELECT Pin
_J_29-Mar-05 1:41
_J_29-Mar-05 1:41 
GeneralRe: Question about SELECT Pin
Colin Angus Mackay29-Mar-05 1:48
Colin Angus Mackay29-Mar-05 1:48 
GeneralRe: Question about SELECT Pin
_J_29-Mar-05 1:51
_J_29-Mar-05 1:51 
GeneralRe: Question about SELECT Pin
Colin Angus Mackay29-Mar-05 1:56
Colin Angus Mackay29-Mar-05 1:56 
GeneralRe: Question about SELECT Pin
_J_29-Mar-05 2:02
_J_29-Mar-05 2:02 
GeneralSaving file in SQL Server Pin
dabuskol25-Mar-05 19:48
dabuskol25-Mar-05 19:48 
GeneralRe: Saving file in SQL Server Pin
turbochimp25-Mar-05 20:12
turbochimp25-Mar-05 20:12 
GeneralSELECT TOP Pin
vuthaianh25-Mar-05 12:10
vuthaianh25-Mar-05 12:10 
GeneralRe: SELECT TOP Pin
turbochimp25-Mar-05 17:49
turbochimp25-Mar-05 17:49 
GeneralSimplify a T-SQL Pin
WDI25-Mar-05 7:41
WDI25-Mar-05 7:41 
GeneralRe: Simplify a T-SQL Pin
Michael Potter25-Mar-05 8:24
Michael Potter25-Mar-05 8:24 
GeneralRe: Simplify a T-SQL Pin
WDI25-Mar-05 9:10
WDI25-Mar-05 9:10 
GeneralRe: Simplify a T-SQL Pin
Michael Potter25-Mar-05 11:34
Michael Potter25-Mar-05 11:34 
GeneralRe: Simplify a T-SQL Pin
Tony Lewis25-Mar-05 9:41
Tony Lewis25-Mar-05 9:41 
GeneralRe: Simplify a T-SQL Pin
andyharman28-Mar-05 4:32
professionalandyharman28-Mar-05 4:32 
GeneralDateTime Pin
vuthaianh25-Mar-05 5:24
vuthaianh25-Mar-05 5:24 

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.