Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Checking column values

Author  Topic 

JR83
Starting Member

31 Posts

Posted - 2014-08-12 : 10:51:41
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
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2014-08-12 : 10:58:47
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

31 Posts

Posted - 2014-08-12 : 11:06:52
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
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2014-08-13 : 11:53:04
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

38200 Posts

Posted - 2014-08-13 : 12:25:28
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
   

- Advertisement -