|
Posted by Roy Harvey on 10/02/93 11:52
On 29 Jun 2006 11:40:22 -0700, "sql guy123" <stoppal@hotmail.com>
wrote:
>Select field1, field2 FROM table1 Where left(field1,4)=left(field2,4)
>
>(MS SQL does not have left() and right() functions)
MS SQL Server does have both LEFT and RIGHT functions.
From the Books on Line for SQL Server 2000:
RIGHT
Returns the right part of a character string with the specified number
of characters.
Syntax
RIGHT ( character_expression , integer_expression )
Arguments
character_expression
Is an expression of character or binary data. character_expression can
be a constant, variable, or column. character_expression can be of any
data type (except text or ntext) that can be implicitly converted to
varchar or nvarchar. Otherwise, use the CAST function to explicitly
convert character_expression.
integer_expression
Is a positive integer that specifies how many characters of the
character_expression will be returned. If integer_expression is
negative, an error is returned.
Return Types
varchar or nvarchar
LEFT
Returns the left part of a character string with the specified number
of characters.
Syntax
LEFT ( character_expression , integer_expression )
Arguments
character_expression
Is an expression of character or binary data. character_expression can
be a constant, variable, or column. character_expression can be of any
data type (except text or ntext) that can be implicitly converted to
varchar or nvarchar. Otherwise, use the CAST function to explicitly
convert character_expression.
integer_expression
Is a positive integer that specifies how many characters of the
character_expression will be returned. If integer_expression is
negative, an error is returned.
Return Types
varchar or nvarchar.
Roy Harvey
Beacon Falls, CT
Navigation:
[Reply to this message]
|