use of host_name( ) in triggers
From: Edward Bogaard (e.bogaard@citee.nl)
Date: 05/28/02
- Next message: frankbuzin: "Re: (Beth?) SQL Ping and Live Address File"
- Previous message: Ayman: "Re: MDF file level security from copying"
- In reply to: Ida: "use of host_name( ) in triggers"
- Next in thread: Ida: "use of host_name( ) in triggers"
- Reply: Ida: "use of host_name( ) in triggers"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
From: "Edward Bogaard" <e.bogaard@citee.nl> Date: Tue, 28 May 2002 04:18:17 -0700
I wasn't able to reproduce your problem using SQL7, it
really inserts the hostname from the trigger. Below is
what I tried. The BOL suggest using HOST_NAME() as a
default value.
Hope this helps,
Edward
---------------------
CREATE TABLE Test
(TEST_ID INT PRIMARY KEY,
[USER] NCHAR(60) NOT NULL,
[TABLE] NCHAR(60) NOT NULL,
Workstation NCHAR(30) NOT NULL,
[DATE] datetime not null
)
GO
CREATE TABLE TEST2
(
TEST2_ID INT PRIMARY KEY,
TEST2_VALUE NCHAR(30) NULL
)
GO
DROP TRIGGER ti_test
CREATE TRIGGER ti_test on TEST2 for insert AS
BEGIN
DECLARE @ID INT
SELECT @ID = isnull(MAX(TEST_ID), 0) + 1 FROM Test
INSERT INTO Test (TEST_ID, [USER], [TABLE],
Workstation, [DATE])
VALUES(@ID, SYSTEM_USER, 'TEST2', HOST_NAME(),
getdate())
END
GO
INSERT INTO TEST2 VALUES (1, 'TEST')
GO
select * from test
GO
- Next message: frankbuzin: "Re: (Beth?) SQL Ping and Live Address File"
- Previous message: Ayman: "Re: MDF file level security from copying"
- In reply to: Ida: "use of host_name( ) in triggers"
- Next in thread: Ida: "use of host_name( ) in triggers"
- Reply: Ida: "use of host_name( ) in triggers"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ] [ attachment ]
Relevant Pages
|
|