467,149 Members | 1,196 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,149 developers. It's quick & easy.

Concat date and time in stored procedure

Soniad
Hello,

I am passing date and time individually to stored procedure as parameters as follows :

Expand|Select|Wrap|Line Numbers
  1. Exec  mySP   '01/31/2009' , '5:03:56 PM' 
whithin this stored procedure, i have declared one variable (senddatetime varchar(50)) ,
i want to concat this date & time and want the date format value as

Expand|Select|Wrap|Line Numbers
  1. 01/31/2009  5:03:56 PM
how to do this in stored procedure, i used many conversion ways, but no solutions.


Regards,
"D"
Jan 31 '09 #1
  • viewed: 7629
Share:
4 Replies
ck9663
Expert 2GB
How does your stored proc look like?

-- CK
Jan 31 '09 #2
Soniad
@ck9663
Here's part of Stored Procedure ,


Expand|Select|Wrap|Line Numbers
  1. CREATE PROCEDURE dbo.SendMsg_proc           
  2.  
  3. @Gdate datetime,          
  4. @GTime datetime,        
  5.  
  6.  
  7. AS           
  8. Begin 
  9.  
  10. Declare @DSentdttime as varchar(50)
  11.  
  12. set @DSentdttime = (select Convert(varchar,@Gdate,101) +' '+  Convert(varchar,@GTime,114))        
  13.  
  14. End


Regards,
"D"
Feb 1 '09 #3
ck9663
Expert 2GB
Pass it as varchar.

--CK
Feb 1 '09 #4
Soniad
@ck9663
Hello,

I declared variable as varchar , and now its working .
Thank you.

Expand|Select|Wrap|Line Numbers
  1. CREATE PROCEDURE dbo.SendMsg_proc            
  2.  
  3. @Gdate  varchar(25),           
  4. @GTime  varchar(25)              
  5.  
  6.  
  7. AS            
  8. Begin  
  9.  
  10. Declare @DSentdttime as varchar(50) 
  11.  
  12. set @DSentdttime = (select @Gdate +' '+ @GTime)         
  13.  
  14. End 
Regards,
"D"
Feb 1 '09 #5

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

7 posts views Thread by Marc Pelletier | last post: by
8 posts views Thread by JIM.H. | last post: by
8 posts views Thread by John Wildes | last post: by
2 posts views Thread by syntego@gmail.com | last post: by
2 posts views Thread by Brad Pears | last post: by
11 posts views Thread by Connie via AccessMonster.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.