Updating a database stored procedure

by  |  01-Dec-2016 19:04

So ultimately strict rule is made that we can't execute stored procedures inside function.

We recommend that you do not create any stored procedures using sp_ as a prefix.

Monitor_Computers (Monitor_Computer_Monitor, Monitor_Computer_Computer) VALUES (@Monitor Id, @Computer Id) END CREATE PROCEDURE Insert Update Serial Inventory --Fixed Name. @Name nvarchar(15), @IPAddress nvarchar(15), @Serial Monitor Table Type READONLY AS BEGIN DECLARE @Monitor Id TABLE (MId int); INSERT INTO dbo. Id INTO @Monitor Id(MId) SELECT Serial FROM @Serial; DECLARE @Computer Id TABLE (CId int); INSERT INTO dbo. Id INTO @Computer Id(CId) VALUES (@Name, @IPAddress); INSERT INTO dbo. CId FROM @Monitor Id AS m CROSS JOIN @Computer Id AS c; END Your ER diagram doesn't seem to model correctly.

Monitor_Computers (Monitor_Computer_Monitor, Monitor_Computer_Computer) SELECT m. How can a monitor be attached to two or more computers?

Note: All timestamps are set in the default values. I keep getting a "Must declare the scalar variable".

-- My Table Parameter Value (TVP) CREATE TYPE Computer Table Type AS TABLE (Name nvarchar(15), IPAddress nvarchar(15)) -- My Stored Procedure (SP) CREATE PROCEDURE sp_Insert Update Serial Inventory @Serial nvarchar(50), @TVPComputer Computer Table Type READONLY AS DECLARE @TVPComputer TABLE (Computers int) INSERT INTO dbo. Id INTO @TVPComputer VALUES (@TVPComputer); INSERT INTO dbo. Id INTO @Serial VALUES (@Serial); working correctly. I found some other topics on this error on Stack Exchange but nothing that resolves my issue. CREATE PROCEDURE sp_Insert Update Serial Inventory @Serial nvarchar(50), @Name nvarchar(15), @IPAddress nvarchar(15) AS BEGIN DECLARE @Monitor Id TABLE (Id int); INSERT INTO dbo. Id INTO @Monitor Id(Id) VALUES (@Serial) DECLARE @Computer Id TABLE (Id int); INSERT INTO dbo. Id INTO @Computer Id(Id) VALUES (@Name, @IPAddress); INSERT INTO dbo.

Net Question Answer site, specially started to allow visitors of this site ask their doubts and queries. Just click the Ask Now button and ask your question now.

Community Discussion