Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase ««12

Need help on SQL script Expand / Collapse
Author
Message
Posted Tuesday, February 04, 2014 10:43 PM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: 2 days ago @ 2:24 PM
Points: 11,990, Visits: 11,007
You do not need to use a loop for this. Just modify the original suggestion so that you only return rows that don't already exist.

_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1538047
Posted Thursday, February 06, 2014 10:52 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, February 06, 2014 1:59 PM
Points: 10, Visits: 36
Thanks Sean, It worked!.
If you know how to do it then it becomes very simple
Thanks all for the helps
Post #1538767
Posted Thursday, February 06, 2014 11:24 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: 2 days ago @ 2:24 PM
Points: 11,990, Visits: 11,007
You are quite welcome. Glad that worked for you.

If possible, can you post what worked you so that others who may stumble across this thread can see a working solution?


_______________________________________________________________

Need help? Help us help you.

Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

Need to split a string? Try Jeff Moden's splitter.

Cross Tabs and Pivots, Part 1 – Converting Rows to Columns
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs
Understanding and Using APPLY (Part 1)
Understanding and Using APPLY (Part 2)
Post #1538779
Posted Thursday, February 06, 2014 1:59 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, February 06, 2014 1:59 PM
Points: 10, Visits: 36
Oh it’s just for me as a learner
What I did is follow Keith’s instruction like below:

insert TBL1
select 3, Col2, Col6, Col4, Col5, Col6 -- replace Col3 with Col6
from TBL1
where Col1 = 1
Post #1538852
« Prev Topic | Next Topic »

Add to briefcase ««12

Permissions Expand / Collapse