I have a set of reports that are run over 4 different companies in the same database.
They are identical except in each case the table names use a different company code.
dbo.[UK$Sales Invoice Header] is used as one table for the UK company report
dbo.[FR$Sales Invoice Header] is used as one table for the FR company report
dbo.[DE$Sales Invoice Header] is used as one table for the DE company report
I have over 20 tables joined and would like to simplify by using a variable for the company part of the table names similar to
DECLARE @Co varchar(2) ='UK';
dbo.[@Co$Sales Invoice Header] in the select statement
Is it possible to use a variable as part of a table name?
Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple. The final solution for this task involved creating a custom text parser and then reading…
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables.
Make a table:
Update a specific column given a specific row using the UPDATE statement:
Remove a set of values using the DELETE s…