Ec (2); Description: In the CREATEVIEW statement, the ANSI_NULLS and QUOTED_IDENTIFIER options must be set to ON. The OBJECTPROPERTY function reports this information table a through the ExecIsAnsiNullsOn or ExecIsQuotedIdentOn attribute for the view. The fields a1, a2, table B, field b1, b2 needs to get a view unionall two tables $ sqlCREATE script ec (2); script
Description:
When creating a VIEW statement, the ANSI_NULLS and QUOTED_IDENTIFIER options must be set to ON. The OBJECTPROPERTY function reports this information for the view through the ExecIsAnsiNullsOn or ExecIsQuotedIdentOn attribute.
Table a, field a1, a2
Table B, field b1, b2
You need to get a view to union all two tables.
$ SQL = 'create VIEW dbo. VIEW2
AS
SELECT * FROM
UNION ALL
(SELECT * FROM B )';
The preceding simple view creation does not have an index. Let's take a look at how to create an index view.
Creates a relational index for a specified table or view. You can create an index before entering data in the table. You can create a relational index for a table or view in another database by specifying a limited database tutorial name.
Syntax:
CREATE [UNIQUE] [CLUSTERED | NONCLUSTERED] INDEX index_name
ON(Column_name [ASC | DESC] [,... n])
[ [,... N]
[ON {filegroup_name | "default"}]
: =
{
[Database_name. [owner_name]. | owner_name.]
Table_or_view_name
}
: =
{
PAD_INDEX
| FILLFACTOR = fillfactor
| SORT_IN_TEMPDB
| IGNORE_DUP_KEY
| STATISTICS_NORECOMPUTE
| DROP_EXISTING
}
// -- Create a view
Create view v
With schemabinding
As
Select ID, name from dbo.
Go
// -- Create an index
Create unique clustered index v_index on v (ID)