... AND (custID = @custID OR @custID = '00000000-0000-0000-0000-000000000000')
This way whenever the calling program passes '00000000-0000-0000-0000-0WHERE custName LIKE @custName
In this case you could specify @custName as 'SM%' and it will find all Smiths, Smirnoffs, ets.WHERE custName = @custName
then you will not be able to use wildcards.
Below is a section of the stored procedure.
@XMLDataSelection text
, @ReportType smallint
, @RankBy smallint
, @RankValue smallint
, @FromDate1 datetime
, @ToDate1 datetime
, @FromDate2 datetime
, @ToDate2 datetime
, @CoType varchar(5)
, @LOBCat smallint
, @TranReporting smallint
, @CustId uniqueidentifier
Below is me passing the parts into the stored procedure to get it to run....
sps_Stored_Procedure (
'<Root><RowId Code="(All)" Type="9" /></Root>'
,<<ReportType [Numeric]>>
, <<RankBy [Numeric]>>
, <<RankValue [Numeric]>>
,'2010-01-01 12:00:00'
,'2013-01-01 12:00:00'
,'2010-01-01 12:00:00'
,'2013-01-01 12:00:00'
,'N'
, <<LOBCat [Numeric]>>
, <<TranReporting [Numeric]>>
,'6B6708EE-E2BC-5C6F-AB9C-
,'A'
, <<SortSequence [Numeric]>>
,'0'
,''
, '!*R'
)
As you can see I have the uniquie ID hard coded. That will not work because I want the report to run for all customers. Some of the parameter are hard coded also so I do not have to type the dates over and over. The <<Prompt>> I can fill in different parameters.
But when I take the , @CustId uniqueidentifier and turn it into
<<CustId uniqueidentifier [Text]>> I get the error of ...Error converting data type nvarchar to uniqueidentifier.:
The program will not close and allow me to run the report because of the error. It understands the following formats. (Numeric, Text, Date, Datetime, Time, Boolean ) Numeric gets me the same error.