Posts

Inserting a string inside string using SQL Server

STUFF() The STUFF function inserts a string into another string. It deletes a specified length of characters in the first string at the start position and then inserts the second string into the first string at the start position. Syntax: STUFF ( character_expression , start , length , replaceWith_expression ) SELECT STUFF ( 'JAINUL KHAN' , 7 , 0 , ' ABDEEN' ); Returns: --------------------- JAINUL ABDEEN KHAN ---------------------

Read more →

Calling a function inside a function asynchronously using JQuery

var Test; $( function () { var ServicePath = rootPath + "Services/TestService.asmx/" ; var ajxcalls = function (methodname, param, success, error) {         $.ajax({             type: "POST" ,             contentType: "application/json; charset=utf-8" ,             cache: false ,             async: false ,             url: ServicePath + methodname,             data: param,             dataType: 'json' ,             success: success,             error: error         });     };     Test = {         Init: function () {             Test.TestCheck();         },         TestCheck: function () {

Read more →

SQL Server 2012 FORMAT Function vs. CONVERT Function

One of the most frequently asked questions in SQL Server forums is how to format a datetime value or column into a specific date format. Here's a summary of the different date formats that come standard in SQL Server as part of the  CONVERT  function and the corresponding syntax using the new SQL Server 2012 FORMAT string function. Following the standard date formats are some extended date formats that are often asked by SQL Server developers, together with the corresponding syntax as well using the new SQL Server 2012 FORMAT string function. It is worth to note that the outputs of these date formats are of VARCHAR data types already and not of  DATETIME  data type. With this in mind, any date comparisons performed after the datetime value has been formatted are using the VARCHAR value of the date and time and not its original  DATETIME  value. The SQL statements used below to return the different date formats use the SYSDATETIME() date function. The SYSDATETIME() function returns a datet…

Read more →

Execute a Stored Procedure Continuously For a Specific Number of Times

I have an Insert Stored Procedure an I want to execute it to 10,00,000 times to put some dummy data in my table, for this I used this…. DECLARE @Counter INT SET @Counter = 1 WHILE ( @Counter <= 1000000 ) BEGIN EXEC [dbo] . [usp_Aspx_SaveValues] 1 , 8 , 1 , 0 SET @Counter = @Counter + 1 END

Read more →