http://computertriksno1.blogspot.in/

Add Table Name And Database Name in Store Procedure

19 Jul 2013 2 comments

Add Table Name And Database Name in Store Procedure 



alter PROCEDURE usp_removeDuplicateHotelMapping_test
(@tablename varchar(200), @databasename AS NVARCHAR(128)='')
as
DECLARE @execquery AS NVARCHAR(MAX)
SET @execquery = N'UPDATE ' + @databasename + '.[dbo].' + @tablename + ' SET mappedto=b.ID FROM ' + @databasename + '.[dbo].' + @tablename + ' A ' + 'INNER JOIN (SELECT MIN(ID) AS ID,mappedto FROM ' + @databasename + '.[dbo].' + @tablename + ' GROUP BY mappedto) B ON A.mappedto=B.mappedto where a.mappedto>a.id'
EXECUTE sp_executesql @execquery
go


usp_removeDuplicateHotelMapping_test 'tab_CitySampleMappings201307182'
go

or


usp_removeDuplicateHotelMapping_test 'tab_CitySampleMappings201307182',’’
go
Share this article :

+ comments + 2 comments

Anonymous
26 July 2013 at 13:44

You can watch on YouTube => Click Here

!!!Demo!!! I am ехtremely іmpresseԁ along with youг ωгiting sκillѕ аnd
also with the layout for уοuг blоg.
ӏs that this a paid subjеct matter or ԁid you customize it yourself?

Αnyway ѕtay up the niсе quality wгiting, it's uncommon to see a great weblog like this one these days..

Here is my website; legal amphetamines !!!Demo!!!

Anonymous
4 August 2013 at 01:24

You can watch on YouTube => Click Here

!!!Demo!!! Hі, i read your blog occаsіоnally
and i own а similaг onе and i wаs just
сurious if you get a lot of ѕpаm сomments?
Ιf so how do you reduce it, any ρlugin or аnуthing you can
аdvise? I get so much latеly it's driving me insane so any help is very much appreciated.

My web-site herbal incense Burner !!!Demo!!!

Post a Comment

 
Support : GDDon | Creating Website | Gddon |
Copyright © 2013. Computer Tricks and Tips for System - All Rights Reserved
Template Created by Creating Website Modify by GDDon.Com
Proudly powered by Blogger