foreign keys

Technical Article

Truncate tables with foreign keys

  • Script

Truncating tables with constraints always had been a pain, since we have to drop and recreate all the FKs. I created a script that takes care of dropping and recreating the foreign keys while truncating. Please use with caution! and always respect your Data !

3.67 (3)

You rated this post out of 5. Change rating

2016-12-01 (first published: )

1,118 reads

Technical Article

RE: selecting max of 2 records per account

  • Reply

Alright.  I may be going around the barn to get to the horse, (or however the saying goes), but this seems to work.  Hopefully, someone will figure out a more elegant and streamline method.  CREATE TABLE #u_external_requests( acct_number int,                                                            idx int,                                                            stage int)   INSERT INTO #u_external_requests VALUES( 1000000179, 1, 7) INSERT INTO […]

You rated this post out of 5. Change rating

2005-05-05

Technical Article

replacing commas in a table field

  • Topic

I am using SQL server 2000 and have a table , in which one of the fields has multiple commas that need to be removed.An eg. of the field is CR 12,455I tried the following:Update TABLE  set field = replace(field,'[,]','')and the result said that it had updated all the rows , but there had been […]

You rated this post out of 5. Change rating

2005-05-05

8 reads

Technical Article

RE: Identity field as a key

  • Reply

Use Int Identities where you can. Make them a primary key, and build a proper relational database with enforced foreign keys and then you wont have data integrity issues. If your entity has an attribute that is unique: create a Natural Key. Using ISBN as the key wouldn't be a good idea if its repeated […]

You rated this post out of 5. Change rating

2005-01-18

Blogs

Deleting Old Local Git Branches–#SQLNewBlogger

By

I had a lot of local branches for a repo (actually a few repos)....

Use Your Voice

By

If you want more of a career and less of a job, one thing...

Real-World SQL Mastery: Your Hands-On, Mess-Free Sandbox

By

Are you ready to take your SQL skills from theoretical to tactical? If you've...

Read the latest Blogs

Forums

7 sept, scheduled book

By philip.scott

Comments posted to this topic are about the item 7 sept, scheduled book

7 sept, schedlued article

By philip.scott

Comments posted to this topic are about the item 7 sept, schedlued article

6 sept, published book

By philip.scott

Comments posted to this topic are about the item 6 sept, published book

Visit the forum

Question of the Day

Azure Data Lake Storage Gen 2

Azure Data Lake Storage Gen 2 is built on ...?

See possible answers