Saturday, October 19, 2019

Expando Object

The ExpandoObject class enables you to add and delete members of its instances at run time and also to set and get values of these members. This class supports dynamic binding, which enables you to use standard syntax like sampleObject.sampleMember instead of more complex syntax like sampleObject.GetAttribute("sampleMember").

Thursday, July 21, 2016

Magic Tables in Stored Procedure

We have seen that  how we can use inserted and deleted magic  table in triggers, now we  will learn  about   magic  tables in  stored procedures.

-- declare @InsertOutput1 table variable
DECLARE @InsertOutput1 table
(
  ID int,
  Title nvarchar(50),
  ModifiedDate datetime
);

-- insert new row into Post table
INSERT INTO Post
OUTPUT INSERTED.*
  INTO @InsertOutput1
VALUES(101, 'One Hundred Years of Solitude', GETDATE());

-- view inserted row in Posttable
SELECT * FROM Post;

-- view output row in @InsertOutput1 variable
SELECT * FROM @InsertOutput1;

In above example  output is nothing  but to get records from inserted magic table, in same  way we can use deleted magic table.