I'm trying to get a stored procedure to work that will copy over the clickthrough and display details from my main database to a new table named based on (at the monent) the month& & year. I can get the name I need for the table however have lucked out in getting it to create the table simply getting an error when using the variable @MonthYr as the table name.
I've shown my code below, any offers on what the issue is?
Declare @MonthYr varchar(14)
Declare @StatsMonth datetime
Declare @StatsYear varchar(8)
Set @StatsMonth=month(GetDate())
Set @StatsYear=CAST((year(getdate()) % 100) AS CHAR(4))
Set @MonthYr='Stats_'+Cast(@StatsMonth as Varchar(3))+Cast(@StatsYear as varchar(4))
SELECT Prod_ID, Product_Name, Displayed_Count, Clickedcount, validtodate, validfromdate, Date_Added, Suspended
INTO @MonthYr
FROM dibby.tbl_Aff_products
Regards,
Phil.
Contact Us here: BSS Details
Remember; the grass is never greener on the other side, merely where you tend to it.
Renners (15-01-10)
Contact Us here: BSS Details
Remember; the grass is never greener on the other side, merely where you tend to it.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks