Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 How to make a date entry

Author  Topic 

jcarnes
Starting Member

5 Posts

Posted - 2007-05-27 : 14:04:25
First, let me say I'm really new (and probably dangerous) with SQL.

I want to take a column in my database called "publish_up" and add 4 days to the date and put it in a column in the database called "publish_down." The publish_up date is the date to start publishing and the publish_down is the date to stop publishing. A Joomla! mambot will then come by and archive the items with a publish_down date that matches today's date.

I'm pretty sure my server has SQL 5 if that's an issue.

Thanks for any advice or help you can offer.

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-05-27 : 19:47:52
quote:
SQL 5

What is the version of SQL Server are you using ? try using print @@version

quote:
I want to take a column in my database called "publish_up" and add 4 days to the date and put it in a column in the database called "publish_down."


update yourtable
set publish_down = dateadd(day, 4, publish_up)



KH

Go to Top of Page

blindman
Master Smack Fu Yak Hacker

2365 Posts

Posted - 2007-05-27 : 19:53:55
Missing a comma!:
update yourtable
set publish_down = dateadd(day, 4, publish_up)

Its the little things that count!

e4 d5 xd5 Nf6
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-05-27 : 19:55:14
thanks blindman


KH

Go to Top of Page

jcarnes
Starting Member

5 Posts

Posted - 2007-05-27 : 20:20:48
I ran it and this is what I got:

MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(day, 4, publish_up)' at line 2

Did I miss something?

I tried the print @@version command and got a similar #1064 error. Maybe what I'm using is something "strange?"

Thanks for the response!!
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-05-27 : 20:23:18
quote:
Did I miss something?

Yes. You are using MySQL instead of MSSQL. This is a MS SQL Server forum. Please post your question in http://forums.mysql.com/


KH

Go to Top of Page

jcarnes
Starting Member

5 Posts

Posted - 2007-05-27 : 20:37:05
Bet you didn't believe me when I said I was new to this? Thanks so much for the steer to the right place! Sorry to have taken you time but thanks for the help.
Go to Top of Page
   

- Advertisement -