Click here to Skip to main content
15,922,007 members
Home / Discussions / Database
   

Database

 
AnswerRe: Delete and effects thereof Pin
Eric Dahlvang21-Nov-06 10:33
Eric Dahlvang21-Nov-06 10:33 
QuestionData Storage from SP Pin
Dayekh20-Nov-06 5:15
Dayekh20-Nov-06 5:15 
AnswerRe: Data Storage from SP Pin
Colin Angus Mackay20-Nov-06 5:30
Colin Angus Mackay20-Nov-06 5:30 
GeneralRe: Data Storage from SP Pin
Dayekh20-Nov-06 5:46
Dayekh20-Nov-06 5:46 
GeneralRe: Data Storage from SP Pin
Colin Angus Mackay20-Nov-06 23:24
Colin Angus Mackay20-Nov-06 23:24 
GeneralRe: Data Storage from SP Pin
Dayekh21-Nov-06 1:28
Dayekh21-Nov-06 1:28 
Questioncheck data integrity using triggers Pin
drequinox20-Nov-06 4:03
drequinox20-Nov-06 4:03 
AnswerRe: check data integrity using triggers Pin
Pete O'Hanlon20-Nov-06 4:33
mvePete O'Hanlon20-Nov-06 4:33 
What you need to do is a pre-insert trigger (or INSTEAD OF).

The steps are:

Create a view that mimics the table that you are trying to insert into.
Attach a trigger to the view. This trigger will be an INSTEAD OF trigger.
In the trigger, do the pre-validation and then insert.

For example:

CREATE TRIGGER MyTrigger ON dbo.vwMyView<br />
INSTEAD OF INSERT AS<br />
<br />
SET NOCOUNT ON<br />
<br />
DECLARE @MyVal NVARCHAR(50)<br />
<br />
SELECT @MyVAL = MyVal FROM INSERTED<br />
<br />
IF @MyVAL IS NOT NULL<br />
BEGIN<br />
INSERT INTO MyTable VALUES (MyVAL) FROM INSERTED<br />
END


Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world."
Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that."

Deja View - the feeling that you've seen this post before.

GeneralRe: check data integrity using triggers Pin
drequinox20-Nov-06 7:27
drequinox20-Nov-06 7:27 
QuestionRe: check data integrity using triggers Pin
drequinox20-Nov-06 9:50
drequinox20-Nov-06 9:50 
QuestionAccess 2000-Jet/VB6 - SQL Query (HELP- SQL Gurus) Pin
tintinchasm19-Nov-06 22:34
tintinchasm19-Nov-06 22:34 
AnswerRe: Access 2000-Jet/VB6 - SQL Query (HELP- SQL Gurus) Pin
rah_sin20-Nov-06 0:02
professionalrah_sin20-Nov-06 0:02 
GeneralRe: Access 2000-Jet/VB6 - SQL Query (HELP- SQL Gurus) Pin
tintinchasm20-Nov-06 6:11
tintinchasm20-Nov-06 6:11 
QuestionENUM Pin
thathvamsi19-Nov-06 21:35
thathvamsi19-Nov-06 21:35 
AnswerRe: ENUM Pin
Leah_Garrett22-Nov-06 13:20
Leah_Garrett22-Nov-06 13:20 
QuestionDB Owner - Diagrams Pin
MatthysDT19-Nov-06 19:59
MatthysDT19-Nov-06 19:59 
AnswerRe: DB Owner - Diagrams Pin
Leah_Garrett22-Nov-06 13:24
Leah_Garrett22-Nov-06 13:24 
QuestionSQL error Pin
walalawll19-Nov-06 15:31
walalawll19-Nov-06 15:31 
AnswerRe: SQL error Pin
Mike Dimmick20-Nov-06 0:52
Mike Dimmick20-Nov-06 0:52 
GeneralRe: SQL error Pin
walalawll29-Nov-06 21:22
walalawll29-Nov-06 21:22 
QuestionTimeout exception error Pin
Lior S19-Nov-06 4:04
Lior S19-Nov-06 4:04 
AnswerRe: Timeout exception error Pin
Colin Angus Mackay19-Nov-06 4:58
Colin Angus Mackay19-Nov-06 4:58 
AnswerRe: Timeout exception error Pin
ThaScorpion19-Nov-06 13:44
ThaScorpion19-Nov-06 13:44 
QuestionDatatype mismatch...column type date/time Pin
Skcheng18-Nov-06 17:09
Skcheng18-Nov-06 17:09 
AnswerRe: Datatype mismatch...column type date/time Pin
Rob Graham19-Nov-06 6:19
Rob Graham19-Nov-06 6:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.