Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create Proc question

Status
Not open for further replies.

charan1976

Programmer
Aug 5, 2002
4
0
0
US
I have a simple Stored Procedure I'm trying to create as follows:
========================================
CREATE Proc CalcInventory
@ItemNo varchar
AS
CREATE VIEW Get_Qty AS
SELECT SUM(Quantity) AS TotalQty
FROM [Tech Chem Corp_$Item Ledger Entry]
WHERE [Tech Chem Corp_$Item Ledger Entry]."Item No_" = '00-0314'
GO
UPDATE [Tech Chem Corp_$Item]
SET [Tech Chem Corp_$Item]."Inventory Calc_" = (SELECT TotalQty FROM GET_QTY)
WHERE [Tech Chem Corp_$Item]."No_" = '00-0314'

drop view get_qty
GO
===========================================

I'm getting the error:
Server: Msg 156, Level 15, State 1, Procedure CalcInventory, Line 4
Incorrect syntax near the keyword 'VIEW'.

Can someone point out what I'm doing wrong here?
TIA
 
Status
Not open for further replies.

Similar threads

Part and Inventory Search

Sponsor

Back
Top