Događaj
31. mar 23 - 2. apr 23
Najveći SKL, Fabric i Pover BI događaj učenja. 31. mart – 2. april. Koristite kod FABINSIDER da uštedite $400.
Registrujte se već danasOvaj pregledač više nije podržan.
Nadogradite na Microsoft Edge biste iskoristili najnovije funkcije, bezbednosne ispravke i tehničku podršku.
Applies to:
SQL Server
Azure SQL Database
Azure SQL Managed Instance
Azure Synapse Analytics
Analytics Platform System (PDW)
You can modify the data of an underlying base table in SQL Server by using SQL Server Management Studio or Transact-SQL.
Requires UPDATE, INSERT, or DELETE permissions on the target table, depending on the action being performed.
In Object Explorer, expand the database that contains the view and then expand Views.
Right-click the view and select Edit Top 200 Rows.
You may need to modify the SELECT statement in the SQL pane to return the rows to be modified.
In the Results pane, locate the row to be changed or deleted. To delete the row, right-click the row and select Delete. To change data in one or more columns, modify the data in the column.
Važno
You cannot delete a row if the view references more than one base table. You can only update columns that belong to a single base table.
To insert a row, scroll down to the end of the rows and insert the new values.
Važno
You cannot insert a row if the view references more than one base table.
In Object Explorer, connect to an instance of Database Engine.
On the Standard bar, click New Query.
Copy and paste the following example into the query window and click Execute. This example changes the value in the StartDate
and EndDate
columns for a specific employee by referencing columns in the view HumanResources.vEmployeeDepartmentHistory
. This view returns values from two tables. This statement succeeds because the columns being modified are from only one of the base tables.
USE AdventureWorks2022;
GO
UPDATE HumanResources.vEmployeeDepartmentHistory
SET StartDate = '20110203', EndDate = GETDATE()
WHERE LastName = N'Smith' AND FirstName = 'Samantha';
GO
For more information, see UPDATE (Transact-SQL).
In Object Explorer, connect to an instance of Database Engine.
On the Standard bar, click New Query.
Copy and paste the following example into the query window and click Execute. The example inserts a new row into the base table HumanResources.Department
by specifying the relevant columns from the view HumanResources.vEmployeeDepartmentHistory
. The statement succeeds because only columns from a single base table are specified and the other columns in the base table have default values.
USE AdventureWorks2022;
GO
INSERT INTO HumanResources.vEmployeeDepartmentHistory (Department, GroupName)
VALUES ('MyDepartment', 'MyGroup');
GO
For more information, see INSERT (Transact-SQL).
Događaj
31. mar 23 - 2. apr 23
Najveći SKL, Fabric i Pover BI događaj učenja. 31. mart – 2. april. Koristite kod FABINSIDER da uštedite $400.
Registrujte se već danasObuka
Dokumentacija
Get information about a view - SQL Server
Learn how to view information about a view from SSMS or T-SQL.
Create views in the Database Engine with SQL Server Management Studio or Transact-SQL.
CREATE VIEW (Transact-SQL) - SQL Server
CREATE VIEW (Transact-SQL)