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 |
|
CoolMoon2011
Starting Member
31 Posts |
Posted - 2011-10-11 : 11:55:44
|
| When I run the query, I got this error below. Msg 117, Level 15, State 1, Procedure proc_inforcebuild_minival_Step_1to5_LZ_2, Line 71The object name 'LTCpdb2.valuation.dbo.MonthlyValFile_current' contains more than the maximum number of prefixes. The maximum is 2.Anyone would like to help me out. How to fix this error. The query that I run is belowselect * into LTCpdb2.valuation.dbo.MonthlyValFile_current from LTCpdb2.valuation.dbo.MonthlyValFile_' + cast(year(@inforce_date)*100 + month(@inforce_date) as char(6)) |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-10-11 : 12:36:11
|
you need dynamic sql for thisDECLARE @Sql varchar(5000)SET @Sql='select * into LTCpdb2.valuation.dbo.MonthlyValFile_currentfrom LTCpdb2.valuation.dbo.MonthlyValFile_' + cast(year(@inforce_date)*100 + month(@inforce_date) as char(6))EXEC (@sql) ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
CoolMoon2011
Starting Member
31 Posts |
Posted - 2011-10-11 : 14:17:41
|
| Great! It works. That's what I did change. Thank you Visakh16. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2011-10-11 : 14:24:54
|
| wc------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
|
|
|