Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- declare @squery varchar(max)
- set @squery = 'if('+CHAR(39)+@AppendType+CHAR(39)+' = ''Address'')
- begin
- update tblchild set name=(REPLACE(LEFT(phone,2)+LEFT(a,1),' ',''))
- update a set a.a=a.name,a.name = b.name,a.email= b.email,a.b = '1' from tblchild as a , tblmaster as b where a.phone = b.phone
- update a set a.name = b.name,a.phone = b.phone,a.a=b.a,a.b = '1' from tblchild as a , tblmaster as b where a.email = b.email and (a.b IS NULL or a.b = '')
- end'
- print(@squery)
- exec (@squery)
- select * from tblchild
- name email phone a b
- s z@a.in 111 NULL 1
- u a@ghf.ij 222 NULL 1
- x qww 333 NULL 1
- ik k@gmail.com 1234567890 NULL 1
- kinjal kin@abc.com 7894561230 NULL 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement