August 17, 2009 at 4:15 am
when i execute the following procedure after creating it i am getting error below.
"alter proc usp_get
as
begin
declare @sql varchar(100)='create view dbo.vw_select asselect '+char(39)+'2009-01-01'+Char(39)+' As a'
print @sql
exec @sql
end
go"
exec usp_get
Error Msg
Msg 2812, Level 16, State 62, Procedure usp_get, Line 6
Could not find stored procedure 'create view dbo.vw_select asselect '2009-01-01' As a'.
Help?
I am created procedure which creates a view in it
Regards
Ramu
August 19, 2009 at 11:00 am
yet another way to skin the cat - no sp_executesql
alter proc usp_get
as
begin
declare @sql varchar(100)
select @sql='create view dbo.vw_select as select '+char(39)+'2009-01-01'+Char(39)+' As a'
print @sql
exec (@sql)
end
go
exec usp_get
RegardsRudy KomacsarSenior Database Administrator"Ave Caesar! - Morituri te salutamus."
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply