|
-
Sep 25th, 2003, 08:18 AM
#1
Thread Starter
Junior Member
What's wrong with this Stored Procedure
I am getting the errors:
Msg 208, Sev 16: Invalid object name 'Archive_VTWINTABLE'. [SQLSTATE 42S02]
Msg 208, Sev 16: Invalid object name 'VTWINTABLE'. [SQLSTATE 42S02]
I checked my tables names and they match the names in the stored procedure.
CREATE PROCEDURE [p_Archive_VTWINTABLE]
AS
Declare @dateCurrentDate datetime
Declare @dblCutoffDays float
Declare @strCutOffDate varchar(11)
Declare @dateCutOffDate datetime
Select @dateCurrentDate = GetDate()
Select @dblCutOffDays = 8 * -1 -- 8 equates to the number of days to keep records in short
Select @strCutOffDate = DateAdd(d, @dblCutOffDays, @dateCurrentDate)
Select @dateCutOffDate = Convert(DateTime, @strCutOffDate)
INSERT INTO Archive_VTWINTABLE SELECT * FROM VTWINTABLE where
RecDate < @dateCutOffDate
Delete VTWINTABLE from VTWINTABLE where
RecDate < @dateCutOffDate
GO
-
Sep 25th, 2003, 08:43 AM
#2
Frenzied Member
it doesn't recognize the names...try putting either [] around them or if the names are actually capitalized...try putting quotes around them.
Being educated does not make you intelligent.
Need a weekend getaway??? Come Visit
-
Sep 25th, 2003, 08:52 AM
#3
Thread Starter
Junior Member
No go!
Tried quotes and brackets and still same error.
-
Sep 25th, 2003, 09:22 AM
#4
Hyperactive Member
As a check try using the full path of the tables:
[ServerName].[DatabaseName].owner.[TableName]
Hard to help on this one as we cant see your server
-
Sep 25th, 2003, 10:33 AM
#5
Two things come to mind....
1) Try specifying the actual field names in the insert...
2) The delete is wrong...
Delete from VTWINTABLE where
RecDate < @dateCutOffDate
It's just Delete From (tbl name)..... not Delete X From (tbl name)....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|