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
 SQL Server 2008 Forums
 Transact-SQL (2008)
 Need Query for insert/update record !!

Author  Topic 

venkata manohar
Starting Member

4 Posts

Posted - 2012-01-10 : 02:22:02
Hi Friends !!

I'm Venkat. I've got a question.

I've a table with EmpID,EmpName,DOB columns.

What i need is to know the message ..if there is any insert/update in the table with DOB<1981...

Note: DOB column has got many years starting from 1970-2000

Here we use triggers as well. But unable to find the perfect logic.


Kindly help me with this guys...!!



Thanks in Advance

Venkat

Sachin.Nand

2937 Posts

Posted - 2012-01-10 : 03:40:07
Whats the problem with triggers ?

After Monday and Tuesday even the calendar says W T F ....
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-01-10 : 04:06:33
why do you need to do check after a report? isnt it just a matter of restricting the insert by means of a check constraint?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-01-10 : 04:08:11
if you want to do it current way. you need a check like

IF EXISTS(SELECT 1 FROM Table WHERE DOB<1981)
PRINT 'your message'

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -