Hy, i'm new on stackoverflow.
I have problem with creating a view in SQL. Here's my code. I'd like to someone help me. Thanks.
USE AdventureWorksLT2012
GO
CREATE VIEW dbo.viewKupciAdrese
AS
SELECT SalesLT.Customer.Title, SalesLT.Customer.FirstName, SalesLT.Customer.LastName,
SalesLT.Customer.EmailAddress, SalesLT.Address.AddressLine1,
SalesLT.Address.AddressLine2, SalesLT.Address.City
FROM SalesLT.CustomerAddress INNER JOIN SalesLT.Customer
ON SalesLT.CustomerAddress.CustomerID = SalesLT.Customer.CustomerID INNER JOIN SalesLT.Address
ON SalesLT.CustomerAddress.AddressID = SalesLT.Address.AddressID
SELECT FirstName,LastName
FROM viewKupciAdrese
ALTER VIEW dbo.viewKupciAdrese
AS
SELECT SalesLT.Customer.Title, SalesLT.Customer.FirstName, SalesLT.Customer.LastName, SalesLT.Customer.EmailAddress, SalesLT.Address.AddressLine1,
SalesLT.Address.AddressLine2, SalesLT.Address.City
FROM SalesLT.CustomerAddress INNER JOIN
SalesLT.Customer ON SalesLT.CustomerAddress.CustomerID = SalesLT.Customer.CustomerID INNER JOIN
SalesLT.Address ON SalesLT.CustomerAddress.AddressID = SalesLT.Address.AddressID
DROP VIEW dbo.viewKupciAdrese
And here's an error.
Msg 102, Level 15, State 1, Procedure viewKupciAdrese, Line 3 Incorrect syntax near 'viewKupciAdrese'.
GOdelimiter after each Data Definition statement (i.e. afterCREATE VIEW ... GOandALTER VIEW ... GO).CREATE VIEW AS SELECT ... GO SELECT FirstName ... GO ALTER VIEW AS SELECT ... GO DROP VIEW ... GO