Monday, November 20, 2017

SQL server find nth Greatest row

  Imaging there is a table named customers and we need to fethch the n th highest row. Customers have a column cust_id (identity column) which may not be uniform Query select t.* from (select...

SQL Server Get all Tables related to a Table with foreign Key

  In cases where we need to find tables related to a table so that all can be dropped for re creation for a table use the following to list tables which...

SQL Server – Bring Database from Single User Mode to MultiUser Mode

  Its often troubles DBAs where once a DB went to Single User Mode it cant revert back to Multi User mode, the error looks some what like this Error Getting :...

How to restart SQL Serives Console.

Go to Start Menu > programs > Administrative Tools > Services > Right Click on "SQL Server (MSSQLSERVER)" and Choose Restart.(This will restart all SQL Services)

MS SQL Server get next Identity insert value

  The problem behind SQL Server Identity field lies where when somebody delete intermediate rows, next identity value may be different from what we expect for eg. if we are inserting from 1...

SQL SERVER Insert result of a Stored Procedure in to a table

Result of Stored procedures are key in most SQL issues, to import resultset into a table , first the DB should include the table, insert into will not work with this scenario For...

ADO.NET Data Services

  Microsoft Data Platform Development Technical Article Ref:MSDN Summary: This document describes how to create and use Microsoft® ADO.NET Data Services, and discusses various details around the URI and payload formats. This document is...

Sql Server Function With Table Parameter and Retuning Table

  its a complex requirement for having table parameters to be passed and returned from a stored procedure by default SQL server doent accept table for this we need to create a user...

Sql server Function Returning a table

here is an example for Functions in SQl Server which returns a table --<START> create function fnTab() returns @tab table( f1 int,f2 varchar(2000) ) as begin --inserting values to the table to be returned insert into @tab values...

what happened when more than one rule assigned to a column in SQL Server

this is a complex case suppose we created 2 rules   create rule rule11 as @r =100 create rule rule111 as @r =1001 and there is a tbale create table t11( cind int) what will happen if we tried to...

More