create procedure ppp1 as
declare @n as numeric(3)
declare @nn as varchar(4)
declare @nnn as numeric(3)
set @n =4exec('select '+COL_NAME(OBJECT_ID(''hlj301cw''), @n)+',eft_ed_no from hlj301cw')
go
exec ppp1
drop procedure ppp1
declare @n as numeric(3)
declare @nn as varchar(4)
declare @nnn as numeric(3)
set @n =4exec('select '+COL_NAME(OBJECT_ID(''hlj301cw''), @n)+',eft_ed_no from hlj301cw')
go
exec ppp1
drop procedure ppp1
declare @n as numeric(3)
declare @nn as varchar(4)
declare @nnn as numeric(3)
set @n =4exec('select '+COL_NAME(OBJECT_ID('hlj301cw'), @n)+',eft_ed_no from hlj301cw')
go
exec ppp1
drop procedure ppp1
create procedure ppp1 as
declare @n as numeric(3)
declare @nn as varchar(4)
declare @nnn as numeric(3)
declare @str varchar(1000)
set @n =4
set @str=COL_NAME(OBJECT_ID('hlj301cw'), @n)
exec('select '+@str +',eft_ed_no
from hlj301cw')
go
exec ppp1
drop procedure ppp1
create procedure ppp1 as
declare @n as numeric(3)
declare @nn as varchar(4)
declare @nnn as numeric(3)
declare @str varchar(1000)
set @n =4
set @str=COL_NAME(OBJECT_ID('hlj301cw'), @n)
exec('select '+@str +'Col1,col2......,eft_ed_no
from hlj301cw')
go
exec ppp1
drop procedure ppp1
declare @n as numeric(3)
declare @nn as varchar(4)
declare @nnn as numeric(3)
set @n =4
declare @SQL varchar(8000)
set @SQL='select '+COL_NAME(OBJECT_ID('hlj301cw'), @n)+',eft_ed_no from hlj301cw'
exec(@sql)
go
exec ppp1
drop procedure ppp1
create procedure ppp1 as
declare @n as numeric(3)
declare @nn as varchar(4)
declare @nnn as numeric(3)
set @n =4exec('select COL_NAME(OBJECT_ID(''hlj301cw''), '+@n+'),hlj301cw from hlj301cw')exec ppp1
drop procedure ppp1