Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase «««1234»»

Truncate Table Expand / Collapse
Author
Message
Posted Thursday, March 28, 2013 2:00 PM


SSCommitted

SSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommittedSSCommitted

Group: General Forum Members
Last Login: Today @ 7:53 AM
Points: 1,554, Visits: 1,636
Thank you for the posting.
We have many different ways to approach it. Is it a good idea or a bad idea?


--------------------------------------
“Everything has beauty, but not everyone sees it.” ― Confucius
Post #1436718
Posted Friday, March 29, 2013 3:52 AM


SSC-Addicted

SSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-AddictedSSC-Addicted

Group: General Forum Members
Last Login: Monday, September 14, 2015 9:34 PM
Points: 429, Visits: 389
gmby (3/28/2013)
good question. but for the life of me, i cannot come up with a reason to use this (nor anyone else where I work)- anybody?

jg


This scenario is often used for hierarchy. Stewart provided an example above.


--------------------------------------------------------------------------------------
Hai Ton
My Db4Breakfast blog.
Post #1436853
Posted Friday, March 29, 2013 10:00 AM


SSCarpal Tunnel

SSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal TunnelSSCarpal Tunnel

Group: General Forum Members
Last Login: Today @ 10:57 AM
Points: 4,042, Visits: 2,289
Outside of a hierarchy example, I can't think of when you would have a table foreign key reference to itself.
Post #1436999
Posted Friday, March 29, 2013 7:07 PM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Today @ 1:04 AM
Points: 2,876, Visits: 1,054
Thanks.
Post #1437169
Posted Monday, April 1, 2013 1:53 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Thursday, February 5, 2015 4:29 AM
Points: 1,028, Visits: 569
Nice one..

--
Dineshbabu
Desire to learn new things..
Post #1437372
Posted Tuesday, April 2, 2013 2:55 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Friday, August 19, 2016 2:13 AM
Points: 2,224, Visits: 7,969
KWymore (3/29/2013)
Outside of a hierarchy example, I can't think of when you would have a table foreign key reference to itself.


A piece of machinery that is no longer available because it has been superseded by a different piece of machinery, something like

create table MachineryParts(
PartID int identity not null primary key,
PartDescription nvarchar(100) not null,
IsAvailable bit not null,
ReplacedByPartID int constraint fkMachineryPartsReplacement foreign key references MachineryParts
)

Post #1437755
Posted Tuesday, April 2, 2013 11:16 AM


SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Friday, August 19, 2016 1:24 PM
Points: 2,881, Visits: 3,604
Strange situation, but informative.

Thanks for the question.

- webrunner


-------------------
"I love spending twice as long and working twice as hard to get half as much done!" – Nobody ever.
Ref.: http://www.adminarsenal.com/admin-arsenal-blog/powershell-how-to-write-your-first-powershell-script

"Operator! Give me the number for 911!" - Homer Simpson

"A SQL query walks into a bar and sees two tables. He walks up to them and says 'Can I join you?'"
Ref.: http://tkyte.blogspot.com/2009/02/sql-joke.html
Post #1438017
Posted Monday, April 8, 2013 6:22 AM


SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Tuesday, August 6, 2013 4:34 AM
Points: 136, Visits: 79
+1 :)

Angad


--Angad Singh
If I Stop Learning, I Cease to Be A SIKH !
Post #1439781
Posted Tuesday, April 9, 2013 12:55 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Wednesday, July 13, 2016 3:42 PM
Points: 1,141, Visits: 1,183
nice and straightforwad - instinct worked for me ..

~ demonfox
___________________________________________________________________
Wondering what I would do next , when I am done with this one
Post #1440174
Posted Monday, April 22, 2013 1:55 AM


Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Monday, May 23, 2016 5:31 AM
Points: 3,615, Visits: 2,774
I got it correct. However assuming some other logic but anyways got corrected by the explanation and got one point (to my bonus)
Post #1444887
« Prev Topic | Next Topic »

Add to briefcase «««1234»»

Permissions Expand / Collapse