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.
select SERVERPROPERTY('MachineName') WindowsServerName