I used some code from the internet to model some of my queries for a stored procedure. It uses the keyword TAB and I have no idea what it does. Can anyone explain this to me?
我使用了一些来自互联网的代码来模拟我对存储过程的一些查询。它使用关键字TAB,我不知道它的作用。任何人都可以向我解释这个吗?
Here is the code:
这是代码:
SELECT * INTO #DailyReport
FROM
(SELECT a.customer,b.cust_name, opendt, txdate [DATE], salesamt
from Daily a left outer join customer b on a.customer =b.customer
where txdate between @begin and @end) TAB
SELECT * INTO #DailyTX
FROM
(SELECT customer, txdate [DATE], SALESTX from Daily
where txdate between @begin and @end) TAB
1 个解决方案
#1
4
This is not a keyword, this is an alias. The user left out the AS keyword (which is legal SQL and allowed)
这不是关键字,这是别名。用户遗漏了AS关键字(这是合法的SQL并允许)
SELECT * INTO #DailyTX
FROM
(SELECT customer, txdate [DATE], SALESTX from Daily
where txdate between @begin and @end) AS TAB
SQL Server requires that sub-queries are aliased so the writter just picked the first 3 letters of TABLE I guess. TMP might have been clearer. It essentially is a variable name.
SQL Server要求子查询具有别名,因此写入程序只选择了我猜的表的前三个字母。 TMP可能更清楚。它本质上是一个变量名。
#1
4
This is not a keyword, this is an alias. The user left out the AS keyword (which is legal SQL and allowed)
这不是关键字,这是别名。用户遗漏了AS关键字(这是合法的SQL并允许)
SELECT * INTO #DailyTX
FROM
(SELECT customer, txdate [DATE], SALESTX from Daily
where txdate between @begin and @end) AS TAB
SQL Server requires that sub-queries are aliased so the writter just picked the first 3 letters of TABLE I guess. TMP might have been clearer. It essentially is a variable name.
SQL Server要求子查询具有别名,因此写入程序只选择了我猜的表的前三个字母。 TMP可能更清楚。它本质上是一个变量名。