3/12/2023 Sql server, .
net and c# video tutorial: Dynamic sql output parameter
The Wayback Machine - [Link]
Sql server, .net and c# video tutorial
Free C#, .Net and Sql server video tutorial for beginners and intermediate programmers.
Support us .Net Basics C# SQL [Link] Aarvi MVC Slides C# Programs Subscribe Download
Dynamic sql output parameter
Suggested Videos
Part 145 - Dynamic sql table name variable
Part 146 - Quotename function in SQL Server
Part 147 - Dynamic SQL vs Stored Procedure
In this video we will discuss, how to use output parameters with dynamic sql. Let us
understand this with an example.
We will use the following Employees table in this demo.
Pragim Technologies - Best software
training and placements in marathahalli,
bangalore. For further details please call
09945699393.
Complete Tutorials
How to become a full stack web
developer
Cloud computing complete tutorial
Healthy food for healthy mind and
body
JavaScript tutorial
Bootstrap tutorial
Angular tutorial for beginners
Angular 5 Tutorial for beginners
[Link] 1/3
3/12/2023 Sql server, .net and c# video tutorial: Dynamic sql output parameter
Important Videos
The Gift of Education
Web application for your business
How to become .NET developer
Resources available to help you
Dot Net Video Tutorials
Blazor tutorial
C tutorial
[Link] Core Tutorial
SQL script to create Employees table
[Link] Core Razor Pages Tutorial
Create table Employees Angular 6 Tutorial
(
ID int primary key identity,
FirstName nvarchar(50), Angular CRUD Tutorial
LastName nvarchar(50),
Gender nvarchar(50), Angular CLI Tutorial
Salary int
) Angular 2 Tutorial
Go
Design Patterns
SOLID Principles
[Link] Web API
Bootstrap
AngularJS Tutorial
jQuery Tutorial
JavaScript with [Link] Tutorial
JavaScript Tutorial
Charts Tutorial
LINQ
Insert into Employees values ('Mark', 'Hastings', 'Male', 60000)
Insert into Employees values ('Steve', 'Pound', 'Male', 45000)
Insert into Employees values ('Ben', 'Hoskins', 'Male', 70000) LINQ to SQL
Insert into Employees values ('Philip', 'Hastings', 'Male', 45000)
Insert into Employees values ('Mary', 'Lambeth', 'Female', 30000) LINQ to XML
Insert into Employees values ('Valarie', 'Vikings', 'Female', 35000)
Insert into Employees values ('John', 'Stanmore', 'Male', 80000) Entity Framework
Go
WCF
We want to write a dynamic sql statement that returns total number of male of female
employees. If the gender value is specified as "Male", then the query should return total [Link] Web Services
male employees. Along the same lines, if the the value for gender is "Female", then we
should get total number of female employees. Dot Net Basics
C#
The following dynamic sql, will give us what we want. In this case, the query returns
total number of "Male" employees. If you want the total number of female employees,
SQL Server
simply set @gender='Female'.
[Link]
Declare @sql nvarchar(max)
Declare @gender nvarchar(10) [Link]
Set @gender = 'Male'
Set @sql = 'Select Count(*) from Employees where Gender=@gender'
Execute sp_executesql @sql, N'@gender nvarchar(10)', @gender GridView
[Link] MVC
At the moment we are not using output parameters. If you want the count of employees
to be returned using an OUTPUT parameter, then we have to do a slight modification to
Visual Studio Tips and Tricks
the query as shown below. The key here is to use the OUTPUT keyword in your
dynamic sql. This is very similar to using OUTPUT parameters with a stored procedure. Dot Net Interview Questions
Declare @sql nvarchar(max)
Slides
[Link] 2/3
3/12/2023 Sql server, .net and c# video tutorial: Dynamic sql output parameter
Declare @gender nvarchar(10)
Entity Framework
Declare @count int
Set @gender = 'Male'
Set @sql = 'Select @count = Count(*) from Employees where Gender=@gender' WCF
Execute sp_executesql @sql, N'@gender nvarchar(10), @count int OUTPUT',
@gender, @count OUTPUT [Link] Web Services
Select @count
Dot Net Basics
The OUTPUT parameter returns NULL, if you forget to use OUTPUT keyword.. The
following query returns NULL, as we removed the OUTPUT keyword from @count C#
parameter
SQL Server
Declare @sql nvarchar(max)
Declare @gender nvarchar(10) [Link]
Declare @count int
Set @gender = 'Male' [Link]
Set @sql = 'Select @count = Count(*) from Employees where Gender=@gender'
Execute sp_executesql @sql, N'@gender nvarchar(10), @count int OUTPUT', GridView
@gender, @count
Select @count
[Link] MVC
Visual Studio Tips and Tricks
Java Video Tutorials
Part 1 : Video | Text | Slides
Part 2 : Video | Text | Slides
Part 3 : Video | Text | Slides
Interview Questions
C#
SQL Server
Written Test
1 comment:
Unknown May 9, 2017 at 2:10 AM
ALLAH bless you
Reply
Enter your comment...
Comment as: Google Accoun
Publish Preview
It would be great if you can help share these free resources
Newer Post Home Older Post
Subscribe to: Post Comments (Atom)
Powered by Blogger.
[Link] 3/3