CodePudding user response:
Under the SQL table must be familiar with commonly used system, syscolumnsCodePudding user response:
The SELECT a.n ame FROM sys. Columns a INNER JOIN sys. Objects ON b b.o bject_id=a.o bject_id
WHERE b.n ame IN (' TAB1, TAB2 ", "TAB3")
GROUP BY a.n ame HAVING COUNT (1)=3
CodePudding user response:
In the CREATE TABLE # A (VARCHAR (20), initial int, warehousing int, outbound int, balance int)
# INSERT INTO A values (' 2020-01, 0187, 28619, 5125, 33)
# INSERT INTO A values (' 2020-02, 12533, 60839-434112)
The CREATE TABLE # B (XXXX VARCHAR (20), int, XXX xx int, outbound int, balance int)
The CREATE TABLE # C (aaaa VARCHAR (20), aaa int, warehousing int, aa int, balance int)
Select the name from (
SELECT the name, ROW_NUMBER () over (partition by the name the order by object_id) rownum
The FROM tempdb for. Sys. The columns WHERE object_id in (object_id (' tempdb for.. # '), A OBJECT_ID (' tempdb for.. B # '), OBJECT_ID (' tempdb for.. C # '))
) where a a.r ownum=3
-- -- -- -- -- tempdb for to change the database name