Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

Browse by Tags · View All
sql_server 217
t-sql 211
tsql 116
sqlserver 96
BRH 78
#SQLServer 66
#TSQL 56
SQL Server 34
function 11
SSMS 9

Archive · View All
August 2007 17
August 2010 8
June 2012 7
June 2011 7
November 2007 7
August 2012 6
May 2012 6
November 2011 6
August 2011 6
October 2011 6

Madhivanan's TSQL Blog

Replace data of one table with data of other table

Jan 8 2010 11:26AM by Madhivanan   

One of the questions asked in a forum was about replacing data of one table by the data of 
another table

The solution that the questioner used was having cursor by looping through the source table and 
replace particular words by other words from another table by matching the words

Here is my alternate solution
declare @Datatable table(Field1 nvarchar(50))

insert into @Datatable (Field1)
select 'testing for this' union all
select 'testing for this to' 
 

declare @MatchTable table(LookFor nvarchar(50),Replacewith nvarchar(50))
insert into @MatchTable (LookFor,Replacewith)
select 'for','with' union all
select 'to','no' 

declare @replace varchar(8000),@with varchar(8000),@sql varchar(8000)

select @replace='',@with ='',@sql=''

select 
        @replace =@replace +'replace(',
        @with =@with +''''+Lookfor +''','''+Replacewith+'''),' 
from 
        @MatchTable 

select @replace=@replace +'''~!@#'',',@with =SUBSTRING(@with,1,len(@with)-1)

select @sql=@sql+REPLACE('select '+@replace+@with,'~!@#',Field1)+' union all ' from @Datatable 

select @sql=SUBSTRING(@sql,1,len(@sql)-10)

select * from @Datatable 

exec(@sql)

Tags: t-sql, sql_server, replace,


Madhivanan
3 · 40% · 12862
0
Liked
 
0
Lifesaver
 
0
Refreshed
 
0
Learned
 
0
Incorrect



Submit

Your Comment


Sign Up or Login to post a comment.

    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]