Posts

Stored procedures with output parameters

ALTER proc [dbo].[sp_addEmployee] (   @name varchar(20),  @email nvarchar(20),   @depId int,   @returnname varchar(40) output   )  as   begin    insert into tblEmployees(empName,empEmail,empDepId) values(@name,@email,@depId) select @returnname =empEmail from tblEmployees where empId=IDENT_CURRENT('tblEmployees') end; Declare @returnvalue varchar(40) Execute sp_addEmployee 'ram','ram124@g.com',1, @returnvalue output; select @returnvalue;
Start Animation By default, all HTML elements have a static position, and cannot be moved. To manipulate the position, remember to first set the CSS position property of the element to relative, fixed, or absolute!

html

Hello World Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.

Clustered and Non-Clustered indexes

  The following are the different types of indexes in SQL Server 1. Clustered 2. Nonclustered 3. Unique 4. Filtered 5. XML 6. Full Text 7. Spatial 8. Columnstore 9. Index with included columns 10. Index on computed columns Create tblEmployees table using the script below. CREATE TABLE  [tblEmployee] ( [Id]  int Primary Key , [Name]  nvarchar (50), [Salary]  int , [Gender]  nvarchar (10), [City]  nvarchar (50) ) Note that  Id  column is marked as  primary key . Primary key, constraint create  clustered indexes automatically  if no clustered index already exists on the table and a nonclustered index is not specified when you create the PRIMARY KEY constraint.  To confirm this ,  execute  sp_helpindex  tblEmployee, which will show a unique clustered index created on the  Id  column.  Now execute the following insert queries . Note that, the values for Id column are not in a sequential order....

Indexes in sql server

Image
  Why indexes? Indexes are used by queries to find data from tables quickly. Indexes are created on tables and views. Index on a table or a view, is very similar to  an index that we find in a book. If you don't have an index in a book, and I ask you to locate a specific chapter in that book, you will have to look at every  page starting from the first page of the book. On, the other hand, if you have the index, you lookup the page number of the chapter in the index, and  then directly go to that page number to locate the chapter. Obviously, the book index is helping to drastically reduce the time it takes to find the  chapter. In a similar way, Table and View indexes, can help the query to find data quickly. In fact, the existence of the right indexes, can  drastically improve the performance of the query. If there is no index to help the query, then the query engine, checks every row in the table from  the beginning to the end. This is called as Tabl...

Cascading referential integrity constraint

CREATE TABLE [dbo].[tblDepartment]( [depId] [int] NOT NULL, [depName] [nvarchar](20) NOT NULL ); CREATE TABLE [dbo].[tblEmployees]( [empId] [int] IDENTITY(1,1) NOT NULL, [empName] [nvarchar](20) NOT NULL, [empEmail] [nvarchar](20) NULL, [empDepId] [int] NULL ); INSERT [dbo].[tblDepartment] ([depId], [depName]) VALUES (1, 'ECE'); INSERT [dbo].[tblDepartment] ([depId], [depName]) VALUES (2, 'CSE'); INSERT [dbo].[tblDepartment] ([depId], [depName]) VALUES (3, 'IT');  INSERT [dbo].[tblEmployees] ([empId], [empName], [empEmail], [empDepId]) VALUES (1, 'datta', 'kumar@g.com', 3); INSERT [dbo].[tblEmployees] ([empId], [empName], [empEmail], [empDepId]) VALUES (3, 'Teja', 'teja@g.com', 1); --set default ALTER TABLE tblEmployees ADD CONSTRAINT df_DepId DEFAULT 1 FOR empDepId; delete from tblDepartment where depId=3; 1. No Action : This is the default behaviour. No Action specifies that if an attempt is made to delete or update ...

sql union and union all

  UNION and UNION ALL operators in SQL Server, are used to combine the result-set of two or more   SELECT queries. Please consider India and UK customer tables below create table tblindiacustomers( id int primary key identity(1,1), name varchar(29), email varchar(30) ); create table tblUSAcustomers( id int primary key identity(1,1), name varchar(29), email varchar(30) ); insert into tblindiacustomers values ('Ram','ram@g.com'), ('Ravi','ravi@g.com'), ('Divya','divya@g.com'); insert into tblUSAcustomers values ('John','john@g.com'), ('Ravi','ravi@g.com'), ('michale','michale@g.com'); select id,name,email from tblindiacustomers union all select id,name,email from tblusacustomers; select id,name,email from tblindiacustomers union select id,name,email from tblusacustomers;

One Page Profile

                       Software Developer Name : Eswara datta Email : eswardatta277@gmail.com Contact/whatsapp : +91-9494088988 Summary :  4  years’ experience in development of Client-Server and Web based applications using, SQL Server, C#,   ASP.NET , ADO.NET,Entityframe work , ASP.NET MVC, HTML, JavaScript, J-Query. Experience in Designing & Creating of Tables, Views, Triggers, Stored procedures, User defined Functions using SQL Server. Experience in developing WEBAPI’s. Experience in using version controlling Gitlab.

Register page with webapi and jquery

<!DOCTYPE html> <html> <head>     <meta charset="utf-8" />     <title></title> </head> <body>     <ul></ul>     <input type="text" id="txtemail" /><br />     <p id="errormsg"></p><br />     <input type="text" id="txtpwd" /><br />     <input type="button" id="alert" value="Register" />     <script src="jquery-3.3.1.min.js"></script>     <script>         var http = "http://localhost:50237/api/constitution";         var error = $("#errormsg").val();         var list = $("ul");         var useremails = [];         var v;         $(document).ready(function () {             $.ajax({       ...

Ajax Script calling APIs

   <script type="text/javascript">         var table = $("#tablee");         var http = "http://192.168.0.112/service.asmx/";         var ddl = $(".ddllist");         var uol = $("#unolst");         $(document).ready(function () {             Bind();             Dropdown();         });         function Bind() {             $.ajax({                 url: http+'ListofEmail',                 method: 'post',                 dataType: 'json',                 success: function (data) {                     $.each(data, function (id...

Bind data with Api and Ajax

   $(document).ready(function () {             Bind();         });         function Bind() {             $.ajax({                 url: http+'ListofEmail',                 method: 'post',                 dataType: 'json',                 success: function (data) {                     $.each(data, function (idx, elem) {                         table.append("<tr><td>" + elem.HOST_EMAIL_ID + "</td><td>" + elem.HOST_PWD + "</td></tr>");                     });                 }, ...

Cors

public static class WebApiConfig     {         public static void Register(HttpConfiguration config)         {             // Web API configuration and services             // Web API routes             var cors = new EnableCorsAttribute("*", "*", "*");             config.EnableCors();             config.MapHttpAttributeRoutes();             config.Routes.MapHttpRoute(                 name: "DefaultApi",                 routeTemplate: "api/{controller}/{id}",                 defaults: new { id = RouteParameter.Optional }             );         }     }

User already Exists

 <script type="text/javascript">         $(document).ready(function(){$('#<%=txtimgtitle .ClientID%>').keyup(function(){var userName=$(this).val();if(userName.length>=1){$.ajax({url:'../webservices/replica.asmx/UserNameExists',method:'post',data:{userName:userName},dataType:'json',success:function(data){var divElement=$('#<%=errormsg .ClientID%>');if(data.UserNameInUse)             {divElement.text(userName+' already exists');divElement.css('color','orange')}             else{divElement.text(userName);divElement.css('color','green')}},error:function(err){alert(err)}})}})});     </script>         <script type="text/javascript">         var employee = {};         var alertmsg = $("#alerttext").val();         $(document).ready(function () {          ...

Cascading Dropdowns

<script type="text/javascript">            var continentsDDL = $('#<%=ddlCountry.ClientID%>');            var countriesDDL = $('#<%=ddlState.ClientID%>');            var citiesDDL = $('#<%=ddlCity.ClientID%>');            $.ajax({                url: '../webservice/service.asmx/ListofCountries',                method: 'post',                dataType: 'json',                success: function (data) {                    continentsDDL.append($('<option/>', { value: -1, text: 'Select Country' }));                    countriesDDL.append($('<option/>', { value: -1, text: ...

Grid view color change for particular cell

   <script>   $(document).ready(function(){          $(this).find("td:eq(0)").addClass('gridcolor'); });         $("#<%=gvConsCanList.ClientID%> tr").click(function (e) {             debugger;             var row = $(e.target).closest("tr");             //elem = row.children[0];             //alert(row.children[0]);             //ele = $(e.target).find('td:first-child').text();            //alert(ele.text());             //var cell1 = $(e.target).closest("td").prev("td").text();             var row = $(e.target).closest("tr");             var selectedcell = $(e.target).closest("td");             var cell0 ...