Posts

Showing posts from 2018

Tricky SQL Interview Questions

SQL Interview Questions How to insert 10 default records in SQL Table. For example suppose we have Student Table with columns Name, Address and other. Write a query to insert default value in one go. INSERT INTO mytable DEFAULT VALUES GO 10 What is GO keyword in SQL? GO keyword is not associated with SQL but it is property of SQL Server Management Studio. GO can be understand simply for following example. Student with Mark on their T-Shirt 1,2,3,4,5,6,7,8,9,10 and 11,12….20 are ready to run in an event but when it is said student from 1 to 10 Go then they start running but students from 11 to 20 wait until they are not said. So it is batch separator in SQL. What is Temp table and Temp variable in SQL and why they are used? 1.       Temp Table store location is Tempdb while Temp variable storage location if not specified is current database. 2.       Table variables can only be accessed within the batch and scope in which they are declared. Temp Tables a

Access API from Stored Procedure in SQL Server

Image
This document describes how to call any API with POST, GET, PUT and DELETE methods from stored procedure. For example, if we want to send email from SQL Server using stored procedure but don’t want to use inbuild functionality of SQL Server but to use any third party API. To make it working (For the purpose of testing) first I created API you can get the API of GET and POST http://mongobox.azurewebsites.net/swagger Now created a CLI Project in Visual Studio and created a method called SendMail which is accepting few parameters like WebURL, EmailTo,EmailBody,EmailSubject. See below image. Now as I am utilizing the POST method API, so I need to pass various parameters in that API and I am passing it to API with given method: (Name, Age and other params are according to API we can use any params as per need of API) Now, I need to build and publish this code in folder to get DLL file which will be used as assembly file in SQL server see below image (We need t

Add Custom Tags in Web config file in ASP .Net

Image
For any reason we want to add some custom tags in web config file but unfortunately these is some predefined tag available for web.config file. To do so we need to create XML file in the format that suits IIS. You can take example of any config present in C:\Windows\system32\inetsrv\config\schema Now create any custom tags and create file and save in the same directory. Now but this is not enough you need to add in applicationhost file as well at C:\Windows\system32\inetsrv\config This will solve your problem and you will be able to add custom config tag in web config file in ASP.Net website.