-----------------------------------------------------------

New Message on BDOTNET

-----------------------------------------------------------
From: ArvindSingh
Message 3 in Discussion


Use is 
null  to check for null values in a column
 
Select * from tbl1 where  ( Cid like 
@Cid or Cid is null ) and ( pid likd @Pid or pid is null) and Fdate >[EMAIL PROTECTED] 

and TDate = @Tdate

 

  -----Original Message-----
From: kumarm 
  [mailto:[EMAIL PROTECTED]
Sent: Tuesday, June 15, 2004 5:08 
  PM
To: [EMAIL PROTECTED]
Subject: Help in sql - stored 
  procedure


  
    
      
      New Message on BDOTNET
    
      

  Help in 
    sql - stored procedure


    
      
      
        Reply

        
          
            
            
               
              Reply to Sender   Recommend 
              Message 1 in 
                Discussion 
      
        
          
            
            
              From: kumarm 
            
              
Hai everyone

This is my 
                Stroreprocedure --- Example

Create sp_test
(
@FDate 
                datetime
@TDate Datetime,
@ Cid varchar(10),
@ PId 
                Varchar(10),
)
as
begin
set nocount on
if @Cid = 
                ''
begin
@Cid = '%'
end

if @Pid = 
                ''
begin
@Pid = '%'
end

Select * from tbl1 where 
                Cid like @Cid and pid likd @Pid and Fdate >[EMAIL PROTECTED] 
and 
                TDate = @Tdate
union
Select * from tbl2 where Cid like 
                @Cid and pid likd @Pid and Fdate >[EMAIL PROTECTED] 
and TDate = 
                @Tdate

set nocount off
end

The problem is 
                :

I have 200 records in my table

When i execute my 
                sp like : sp_test '01 may 2004,'30 jun 2004','',''

I am 
                getting only 180 records, but there is 200 records.
After 
                checking the table i found in the tbl1 for the colum CID there 
                is 
Null value.

Why when i give '%' i not taking all 
                the value for --- cid like '%'

how to get all the values 
                from the table using and modifying the 
                
storeprocedure.

Please need help very 
                urgent

with 
                regards
kumar.m

_________________________________________________________________
Looking 
                for something? Cant find it anywhere? 
                
http://go.msnserver.com/IN/50756.asp Log onto 
                baazee.com


View other groups in this 
    category. 



-----------------------------------------------------------

To stop getting this e-mail, or change how often it arrives, go to your E-mail 
Settings.
http://groups.msn.com/BDotNet/_emailsettings.msnw

Need help? If you've forgotten your password, please go to Passport Member Services.
http://groups.msn.com/_passportredir.msnw?ppmprop=help

For other questions or feedback, go to our Contact Us page.
http://groups.msn.com/contact

If you do not want to receive future e-mail from this MSN group, or if you received 
this message by mistake, please click the "Remove" link below. On the pre-addressed 
e-mail message that opens, simply click "Send". Your e-mail address will be deleted 
from this group's mailing list.
mailto:[EMAIL PROTECTED]

Reply via email to