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 |
|
dprasad1
Starting Member
4 Posts |
Posted - 2002-05-10 : 14:19:28
|
| I am trying to populate a column with date/time info, I am doing this so I can use getdate() on the data for other computations (the format is mon/day/yr/hours/mins, i was told only data having mon/day/yr format can be used with getdate()). The code below says that dateyest is an invalid object name. Actually, any kind of insert I do reports the same error, no matter what column it is (securty on my account is all set, as well as for the stored proc.). I must be overlooking something very simple, right? thanks for the help!DECLARE @dateYest datetimeDECLARE Cur668 CURSORKeysetFORSELECT cast(date1 as datetime) dtFROM baclosetableOPEN Cur668fetch next from cur668 into @dateyestWHILE @@FETCH_STATUS = 0BEGINif @dateyest is not nullInsert dateyest VALUES (@dateYest)fetch next from cur668 into @dateyestENDCLOSE Cur668DEALLOCATE Cur668 |
|
|
AjarnMark
SQL Slashing Gunting Master
3246 Posts |
Posted - 2002-05-10 : 15:08:34
|
| The problem appears to be in your INSERT statement:INSERT dateyest VALUES(@dateYest).Is the first dateyest a valid name of a table in your database? The normal syntax is INSERT YourTableName (fieldlist) VALUES (valuelist) |
 |
|
|
aiken
Aged Yak Warrior
525 Posts |
Posted - 2002-05-10 : 16:11:43
|
| I'm also confused about the table you're trying to insert into. Are you trying to create a datetime column in baclosetable?It also looks very likely that you don't need the cursor at all... can you post a more clear description of what tables you have and where you're trying to insert the datetime field?Cheers-b |
 |
|
|
|
|
|