SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Checking column values
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

JR83
Starting Member

South Africa
31 Posts

Posted - 08/12/2014 :  10:51:41  Show Profile  Reply with Quote
hi there

im new at this.. i just want some advise

Will this script check the existing values in a column or am i missing something?


if EXISTS(select 1
FROM inserted
INNER JOIN TESTTABLE M ON
inserted.ID= M.ID
WHERE inserted.RECORD_Id >= inserted.RECORD_Id)

Everything seems hundreds, i now just need it to check the the existing values in the table

I am losing my mind and just cant seem to get it right at all.

Bustaz Kool
Flowing Fount of Yak Knowledge

USA
1696 Posts

Posted - 08/12/2014 :  10:58:47  Show Profile  Reply with Quote
What do you mean by "check"? What do you mean by "Everything seems hundreds"? I'm assuming that this is in a trigger, correct?



Too often we enjoy the comfort of opinion without the discomfort of thought. - John F. Kennedy
Go to Top of Page

JR83
Starting Member

South Africa
31 Posts

Posted - 08/12/2014 :  11:06:52  Show Profile  Reply with Quote
I need it to check for duplicates in the column, that have already been inserted.
i cant see where im going wrong in order to achieve this

yes its a trigger
Go to Top of Page

Bustaz Kool
Flowing Fount of Yak Knowledge

USA
1696 Posts

Posted - 08/13/2014 :  11:53:04  Show Profile  Reply with Quote
I'm still a bit unclear on your requirements. It's not clear why you need a where clause. An item exists if the Insert and TESTTABLE share the same record_id. What is your trigger attempting to do?



Too often we enjoy the comfort of opinion without the discomfort of thought. - John F. Kennedy
Go to Top of Page

tkizer
Almighty SQL Goddess

USA
36952 Posts

Posted - 08/13/2014 :  12:25:28  Show Profile  Visit tkizer's Homepage  Reply with Quote
This appears to be a duplicate of this post: http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=195701

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.08 seconds. Powered By: Snitz Forums 2000