I have a simple table as follows
CREATE TABLE [accounting].[ExtractControl](
[SourceSchema] [varchar](50) NOT NULL,
[SourceTable] [varchar](150) NOT NULL,
[SourceDatabase] [varchar](50) NOT NULL)
I would like to select SourceDatabase using SourceSchema and SourceTable values
Currently I am doing with multiple queries as follows
Select @s1 = SourceDatabase from accounting.ExtractControl where SourceSchema = 'xxx' and SourceTable = 'xxx'
Select @s2 = SourceDatabase from accounting.ExtractControl where SourceSchema = 'yyy' and SourceTable = 'yyy'
Select @s3 = SourceDatabase from accounting.ExtractControl where SourceSchema = 'xxx' and SourceTable = 'yyy'
I do believe that this can be done in more elegant ways! Thanks for the help!