December 3, 2009 at 4:49 pm
Hi I have been struggling with this for awhile so thought id post it. Basically I have a table with a date and an id.
I wish to add a constraint to the table so that a new date entered for a particular Id is greater than the maximum date thats already there for that Id. Hope this makes sense..I have created a customer table to start with..can someone please help me..thanks..Fred
CREATE TABLE [dbo].[Customer](
[id] [int] NULL,
[rundate] [datetime] NOT NULL
) ON [PRIMARY]
GO
December 4, 2009 at 7:37 am
I believe in SQL Server you will need to do this in a trigger or in the process that does the insert. I'd lean toward having it in the application that does the insert. Check before you do the insert.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
December 4, 2009 at 7:54 am
Why dont u just do the check in the proc that is loading the record?
December 4, 2009 at 1:07 pm
I need to do at database level because i am using an open source code to create the data entry screens. So dont have access to the procedures
Do you know of any trigger examples that i could start with
thanks for your reply
December 4, 2009 at 1:28 pm
If you are not familiar with triggers I recommend reading this article[/url]. Then write some code and post it here and we'll check it out.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply