We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

Sql query to insert unique url in sql server 2000 database.

Medium Priority
417 Views
Last Modified: 2012-05-07
Hi,

I have sql insert query that is used to add url in th database. Suppose
urltitle="google"" and url="http://www.google.com" is present in the database.
I dont want same url url="http://www.google.com" will insert again.

here is my insert query
INSERT INTO linkstable (UrlTitle, Url, UserID,DateTimeStamp)
VALUES ('google','http://www.google.com','sam',GETDATE())

UrlID is the  primary key. I dont want that user can add same url again in the database if its present

thanks
Comment
Watch Question

Database Consultant
CERTIFIED EXPERT
Top Expert 2009
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
I cant set unique key to url column as my primary key is urlid.

Commented:
Yes you can

Open designer, right click on any column, select indexes, say add, and after selecting the new index, change the column to url column and say yes to unique parameter.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.