Skip to main content
deleted 8 characters in body
Source Link
RBarryYoung
  • 57k
  • 15
  • 99
  • 142

Use a temporary table:

CREATE TABLE #variables  ( VarName VARCHAR(20) PRIMARY KEY, Value VARCHAR(255)  ) GO Insert into #variables Select 'Bob', 'SweetDB' GO Select Value From #variables Where VarName = 'Bob' GO DROP TABLE #variables go 

Use a temporary table:

CREATE TABLE #variables  ( VarName VARCHAR(20) PRIMARY KEY, Value VARCHAR(255)  ) GO Insert into #variables Select 'Bob', 'SweetDB' GO Select Value From #variables Where VarName = 'Bob' GO DROP TABLE #variables go 

Use a temporary table:

CREATE TABLE #variables ( VarName VARCHAR(20) PRIMARY KEY, Value VARCHAR(255) ) GO Insert into #variables Select 'Bob', 'SweetDB' GO Select Value From #variables Where VarName = 'Bob' GO DROP TABLE #variables go 
Source Link
RBarryYoung
  • 57k
  • 15
  • 99
  • 142

Use a temporary table:

CREATE TABLE #variables ( VarName VARCHAR(20) PRIMARY KEY, Value VARCHAR(255) ) GO Insert into #variables Select 'Bob', 'SweetDB' GO Select Value From #variables Where VarName = 'Bob' GO DROP TABLE #variables go