CREATE TABLE #tmpTable ( COL1 int, COL2 int, COL3 nvarchar(max), COL4 nvarchar(max), COL5 bit ) INSERT INTO #tmpTable exec SpGetRecords ‘Params’ NOTE: The columns of #tmpTable must be the same as SpGetRecords. Otherwise, there will be a problem. If there are no parameters in the stored procedure, you don’t need to use ‘Params’.
Tag: insert
How to add Output Parameter to SqlDataSource
<asp:Parameter Name=”NewID” Direction=”Output” Type=”Int32″ DefaultValue=”0″ /> Here is a more detailed example in use: <asp:sqlDataSource ID=”EmployeeDetailsSqlDataSource” SelectCommand=”SELECT EmployeeID, LastName, FirstName FROM Employees WHERE EmployeeID = @EmpID” InsertCommand=”INSERT INTO Employees(LastName, FirstName) VALUES (@LastName, @FirstName); SELECT @EmpID = SCOPE_IDENTITY()” UpdateCommand=”UPDATE Employees SET LastName=@LastName, FirstName=@FirstName WHERE EmployeeID=@EmployeeID” DeleteCommand=”DELETE Employees WHERE EmployeeID=@EmployeeID” ConnectionString=”<%$ ConnectionStrings:NorthwindConnection %>” OnInserted=”EmployeeDetailsSqlDataSource_OnInserted” RunAt=”server”> <SelectParameters> <asp:Parameter […]
How to insert space in Razor Asp.Net
@if (condition) { <text> </text> @: }
Set Identity Insert On/Off in MSSQL
SET IDENTITY_INSERT MyTable ON INSERT INTO MyTable (IdentityColumn, col2, col3, …) VALUES (IdentityValue, col2value, col3value, …) SET IDENTITY_INSERT MyTable OFF Note that you can not insert explicit value for identity column in table ‘MyTable’ when IDENTITY_INSERT is set to OFF.
Return number of rows affected by UPDATE statements in SQL
DECLARE @Teams TABLE( Name varchar(100) ) INSERT INTO @Teams VALUES (N’GALATASARAY’) INSERT INTO @Teams VALUES (N’LIVERPOOL’) INSERT INTO @Teams VALUES (N’BARCELONA’) INSERT INTO @Teams VALUES (N’PARIS SAINT GERMAIN’) INSERT INTO @Teams VALUES (N’JUVENTUS’) UPDATE @Teams SET Name = N’PORTO’ WHERE Name = ‘PARIS SAINT GERMAIN’ SELECT @@ROWCOUNT –gives 1