Export (0) Print
Expand All
ABS
ALL
AND
ANY
AVG
bit
COS
COT
DAY
EXP
GO
IN
LEN
LOG
MAX
MIN
NOT
OR
PI
SET
SIN
STR
SUM
TAN
USE
VAR
Expand Minimize
2 out of 3 rated this helpful - Rate this topic

HOST_ID

SQL Server 2000

Returns the workstation identification number.

Syntax

HOST_ID ( )

Return Types

char(8)

Remarks

When the parameter to a system function is optional, the current database, host computer, server user, or database user is assumed. Built-in functions must always be followed by parentheses.

System functions can be used in the select list, in the WHERE clause, and anywhere an expression is allowed.

Examples

This example creates a table that uses HOST_ID() in a DEFAULT definition to record the terminal ID of computers that insert rows into a table recording orders.

CREATE TABLE Orders
   (OrderID     INT       PRIMARY KEY,
    CustomerID  NCHAR(5)  REFERENCES Customers(CustomerID),
    TerminalID  CHAR(8)   NOT NULL DEFAULT HOST_ID(),
    OrderDate   DATETIME  NOT NULL,
    ShipDate    DATETIME  NULL,
    ShipperID   INT       NULL REFERENCES Shippers(ShipperID))
GO

See Also

Expressions

System Functions

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.