BravehearT-1326
asked on
Convert a sql_variant value to a varchar
Hi there I'd like to be able to place the value returned from the command below into a varchar variable to use in a script but I am getting the error:
Implicit conversion from data type sql_variant to varchar is not allowed. Use the CONVERT function to run this query.
Ideally I'd like to have something like:
DECLARE @server varchar(50)
set @server = (select SERVERPROPERTY('MachineNam e') WindowsServerName) whilst using the CONVERT function - can anyone help as I'm really new to TSQL programming.
Thanks
Implicit conversion from data type sql_variant to varchar is not allowed. Use the CONVERT function to run this query.
Ideally I'd like to have something like:
DECLARE @server varchar(50)
set @server = (select SERVERPROPERTY('MachineNam
Thanks
select SERVERPROPERTY('MachineName') WindowsServerName
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER