| Author |
Topic |
|
masterdineen
Aged Yak Warrior
550 Posts |
Posted - 2009-11-04 : 07:41:16
|
| Hello thereIm trying to create a constraint on a DateTime type. I haveDateCheck datetime null check (dateCheck >= January 1, 1900 and dateCheck <= june 6, 2079),and i keep getting an error saying syntax error near '1'just can not see whats wrong.many thanksRegardsRobMCTS certified |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2009-11-04 : 07:50:08
|
use ISO format>= '19000101'<= '20790606' KH[spoiler]Time is always against us[/spoiler] |
 |
|
|
masterdineen
Aged Yak Warrior
550 Posts |
Posted - 2009-11-04 : 07:58:13
|
| excellent thank you RobMCTS certified |
 |
|
|
masterdineen
Aged Yak Warrior
550 Posts |
Posted - 2009-11-04 : 08:36:39
|
| Now when i insert to the column.insert into table for datatime columnvalues ( '20090817')i get Arithmetic overflow error converting expression to data type datetimeMCTS certified |
 |
|
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2009-11-04 : 08:50:54
|
| Have you tried ???create table #sample (date_column datetime)insert into #sample values('20090817')select * from #sampleits working..Senthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/ |
 |
|
|
masterdineen
Aged Yak Warrior
550 Posts |
Posted - 2009-11-04 : 09:00:00
|
| yes thats working,but not with my table containing columnDateCheck datetime null check (dateCheck >= 19000101 and dateCheck <= 20790606),MCTS certified |
 |
|
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2009-11-04 : 09:04:33
|
quote: Originally posted by masterdineen yes thats working,but not with my table containing columnDateCheck datetime null check (dateCheck >= 19000101 and dateCheck <= 20790606),MCTS certified
It will works for Ucreate table #sample (DateCheck datetime null check (dateCheck >= '19000101' and dateCheck <= '20790606') )insert into #sample values('20090817')select * from #sampleSenthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/ |
 |
|
|
masterdineen
Aged Yak Warrior
550 Posts |
Posted - 2009-11-04 : 09:12:16
|
| I have just created a temp table with the checkdate columninserted a date, and still get the arithmetic overflow errori can not see what im doing wrongMCTS certified |
 |
|
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2009-11-04 : 09:13:39
|
| Have you check my previous post???Senthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/ |
 |
|
|
masterdineen
Aged Yak Warrior
550 Posts |
Posted - 2009-11-04 : 09:19:00
|
| yes. as mine saysi have created a temp table as you suggested. and im still getting and error with my column sytax(DateCheck datetime null check (dateCheck >= '19000101' and dateCheck <= '20790606')MCTS certified |
 |
|
|
rajdaksha
Aged Yak Warrior
595 Posts |
Posted - 2009-11-04 : 09:23:54
|
| Hican you post your table structure and insert query part.-------------------------R... |
 |
|
|
masterdineen
Aged Yak Warrior
550 Posts |
Posted - 2009-11-04 : 09:34:59
|
| create table integTask (PNumber int identity(1,1) primary key,dateCheck datetime null check (datecheck >= 19000101 and dateCheck <= 20790606))MCTS certified |
 |
|
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2009-11-04 : 09:46:24
|
quote: Originally posted by masterdineen create table integTask (PNumber int identity(1,1) primary key,dateCheck datetime null check (datecheck >= 19000101 and dateCheck <= 20790606))MCTS certified
dateCheck datetime null check (datecheck >= '19000101' and dateCheck <= '20790606'))Senthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/ |
 |
|
|
masterdineen
Aged Yak Warrior
550 Posts |
Posted - 2009-11-04 : 09:50:33
|
| argggsomething small againthank you very much. sorry to have such an easy questionThank youMCTS certified |
 |
|
|
senthil_nagore
Master Smack Fu Yak Hacker
1007 Posts |
Posted - 2009-11-05 : 00:24:52
|
| Welcome :)Senthil.C------------------------------------------------------[Microsoft][ODBC SQL Server Driver]Operation canceledhttp://senthilnagore.blogspot.com/ |
 |
|
|
|