![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have had an odd error message today from "Microsoft SQL Server 2005 - 9.00.4035.00 (X64)" that suggests that the following test did not work as intended, which was to generate and execute dynamic SQL code to create a table (by SELECT INTO) if the table does not already exist. The table does exist, so I would expect OBJECT_ID(...) NOT NULL. The "path" consists of a database name and ".[dbo].", I'm reasonably sure. And apparently it works /now/. Should I be using a different "object there" test? ---- SET @tblPeriod_fq = @pathTarget_q + N'[period]' IF ( OBJECT_ID(@tblPeriod_fq) IS NULL ) BEGIN .... |
#3
| |||
| |||
|
|
I have had an odd error message today from "Microsoft SQL Server 2005 - 9.00.4035.00 (X64)" that suggests that the following test did not work as intended, which was to generate and execute dynamic SQL code to create a table (by SELECT INTO) if the table does not already exist. The table does exist, so I would expect OBJECT_ID(...) NOT NULL. The "path" consists of a database name and ".[dbo].", I'm reasonably sure. And apparently it works /now/. Should I be using a different "object there" test? ---- SET @tblPeriod_fq = @pathTarget_q + N'[period]' IF ( OBJECT_ID(@tblPeriod_fq) IS NULL ) BEGIN .... What is the odd error message? How did the complete batch look like? |
#4
| |||
| |||
|
|
Sorry for the late reply. That isn't the error message, it wasn't really odd - just, that table "period" already existed, when the code was trying to create it. The odd thing was that it happened - and then that it didn't happen when I re-ran the procedure. Below is more of the code that I think generated the error message. |
![]() |
| Thread Tools | |
| Display Modes | |
| |