MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMS SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 10th, 2008, 08:48 AM
swimlikehell swimlikehell is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2008
Posts: 35 swimlikehell User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 h 51 sec
Reputation Power: 1
Problem adding days to a date using DATEADD

I am trying to pass a stored procedure a variable that allows the user to specify how may days should be added to the date. I am getting an error since I'm not 100% sure how I need to declare the variable I am using int currently and the date add function look like:

DATEADD(dd, ' + @DaysToadvnce + ', ''' + cast(@today as nvarchar(50)) + '''))

the actual query is a string also. Any help would be much appreciated, Thanks.

Reply With Quote
  #2  
Old July 10th, 2008, 08:57 AM
swimlikehell swimlikehell is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2008
Posts: 35 swimlikehell User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 h 51 sec
Reputation Power: 1
I figured out what I needed to do:

DATEADD(dd, ' + cast(@DaysToadvnce as nvarchar(50) + ', ''' + cast(@today as nvarchar(50)) + '''))

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > Problem adding days to a date using DATEADD


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway