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 |
|
OWSQL
Starting Member
27 Posts |
Posted - 2011-11-24 : 05:43:22
|
| Hi I have a table where a column "begtime" is defined as datatype "datetime". I need to update another column based on the value in begtime but for some reason I cannot update this because my where clause cannot find the column value. This is just a test query which I run on the table below. No matter what I write in the like '2011-11-01....' I get nothing. Many other updates in the same table works fine, so I think it is due to some datatype mismatch? Any ideas?select * from dbo.Stresstest_Relative_FutSwapswhere begtime like '2011-11-01%'product tradetype begtime qty gns_price Unit New_qtyHS Rtdm 3.5% FOB Barges Swap Exchange 2011-11-01 00:00:00.000 -4000 559,85147 mt -4000HS Rtdm 3.5% FOB Barges Swap Exchange 2011-11-01 00:00:00.000 10000 631,875 mt 10000HS Rtdm 3.5% FOB Barges Swap OTC 2011-11-01 00:00:00.000 -9005 577,047149 mt -9005HS Rtdm 3.5% FOB Barges Swap Exchange 2011-12-01 00:00:00.000 1000 574,437804 mt 1000HS Rtdm 3.5% FOB Barges Swap OTC 2011-12-01 00:00:00.000 -4025 584,361781 mt -4025HS Rtdm 3.5% FOB Barges Swap Exchange 2012-01-01 00:00:00.000 3000 601,668831 mt 3000 |
|
|
RickD
Slow But Sure Yak Herding Master
3608 Posts |
Posted - 2011-11-24 : 05:46:22
|
| select * from dbo.Stresstest_Relative_FutSwapswhere begtime = '2011-11-01'This should work.If you want a range, use > and <=or you could use BETWEEN if there are no nulls. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|