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.
| Author |
Topic |
|
scottpaul4000
Starting Member
4 Posts |
Posted - 2007-10-29 : 13:02:55
|
| When I run this it returns data correctlyselect *from toc t inner join td8 don t.tocid = d.tocidwhere t.parentid = 406623 and YEAR(d.date) = 2005When I run this:BeginUpdate td8set td8.year = '2005'from toc t inner join td8 don t.tocid = d.tocidwhere t.parentid = 406623 and YEAR(d.date) = 2005I get the following message:Server: Msg 170, Level 15, State 1, Line 6Line 6: Incorrect syntax near '2005'.I'm guessing the year and date fields and year and date functions are causing the problems but I'm just guessing. Anyone got advise for the new guy? |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-10-29 : 13:03:58
|
| Remove the quotes around 2005.You need quotes for strings not numeric values.Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
|
scottpaul4000
Starting Member
4 Posts |
Posted - 2007-10-29 : 13:23:46
|
| Actually TD8.Year is a string field. (don't ask why, it's along story)I tried removing the quotes anyway and got the same results. |
 |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-10-29 : 13:26:10
|
| And what is the datatype for d.date?Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
|
scottpaul4000
Starting Member
4 Posts |
Posted - 2007-10-29 : 13:46:41
|
| Datetime |
 |
|
|
scottpaul4000
Starting Member
4 Posts |
Posted - 2007-10-29 : 14:01:47
|
| Here's the problem, I'm an idiot. The first line was supposed to be BEGIN TRAN not Begin. What it was expecting was End.Thanks for the help though. I appreciate it. |
 |
|
|
dinakar
Master Smack Fu Yak Hacker
2507 Posts |
Posted - 2007-10-29 : 15:18:08
|
| ahh..Dinakar Nethi************************Life is short. Enjoy it.************************http://weblogs.sqlteam.com/dinakar/ |
 |
|
|
|
|
|