Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Member
296 Points
410 Posts
Apr 30, 2012 07:05 PM|LINK
Whats wrong with this?
create procedure dbo.[schema_update]
@dbname varchar(50)
as
begin
select * from [@dbname].INFORMATION_SCHEMA.COLUMNS
end
go
now i am executing the sp as
execute [dbo].[schema_update] 'abcd'
i am getting the following error
invalid object name @dbname..INFORMATION_SCHEMA.COLUMNS
i am trying to pass database name as parameter
Csharp22
Member
296 Points
410 Posts
Query help
Apr 30, 2012 07:05 PM|LINK
Whats wrong with this?
create procedure dbo.[schema_update]
@dbname varchar(50)
as
begin
select * from [@dbname].INFORMATION_SCHEMA.COLUMNS
end
go
now i am executing the sp as
execute [dbo].[schema_update] 'abcd'
i am getting the following error
invalid object name @dbname..INFORMATION_SCHEMA.COLUMNS
i am trying to pass database name as parameter