///////////////// Sql
declare @Fieldname VARCHAR(max),
SELECT @Fieldname
= COALESCE(@Fieldname + iif(len(@Fieldname)>0, ',',''), '') + CAST(Fieldname AS VARCHAR(5))
FROM tbl_Table_Fields
select @Fieldname
***************************---********************
declare @Fieldname VARCHAR(max)
SELECT @Fieldname = COALESCE(@Fieldname + iif(len(@Fieldname)>0, ',',''), '') + 'cast(['+Fieldname+'] as varchar(150))['+Fieldname+']' FROM tbl_Table_Fields order by RID
select @Fieldname
/////////////// REsult
cast([Reservior_Level] as varchar(150))[Reservior_Level], cast([TMC_GrossCapacity] as
varchar(150))[TMC_GrossCapacity], cast([TMC_Live_Above_Cill]
as varchar(150))[TMC_Live_Above_Cill],
cast([TMC_Above_Cill] as varchar(150))[TMC_Above_Cill], cast([Flow_Inflow] as varchar(150))[Flow_Inflow], cast([Flow_OutFlow] as varchar(150))[Flow_OutFlow], cast([Flow_Withdrawal] as varchar(150))[Flow_Withdrawal], cast([Cum_TMC_Inflow] as varchar(150))[Cum_TMC_Inflow], cast([Cum_TMC_OutFlow] as varchar(150))[Cum_TMC_OutFlow], cast([Cum_TMC_Withdrawl] as
varchar(150))[Cum_TMC_Withdrawl], cast([Evaporation] as varchar(150))[Evaporation], cast([Cum_Evaporation] as varchar(150))[Cum_Evaporation], cast([River_Spillway] as varchar(150))[River_Spillway], cast([River_PowerHouse] as
varchar(150))[River_PowerHouse], cast([River_Sluice] as varchar(150))[River_Sluice], cast([Other_Abstractions] as
varchar(150))[Other_Abstractions]
No comments:
Post a Comment