Showing posts with label SQL. Show all posts
Showing posts with label SQL. Show all posts

Monday, January 12, 2015

Generate Row Serial Numbers in SQL Query

SELECT row_number() over (order by AAL.Record_ID) as "No"

Sunday, December 21, 2014

Calling stored procedure from another stored procedure SQL Server


While migrating users in SharePoint, i need to take care of migrating user in custom DB level.
Wrote a below script to upgrade the users with new DOMAIN account name.

ALTER PROCEDURE [DB3].[dbo].[UpdateDomainUser_WithClaim]
(
@oldUser nvarchar(300),
    @newUser nvarchar(300)
    )
AS
BEGIN
....
EXEC [DB1].[dbo].UpdateDomainUser_SP1_WithClaim @oldUser ,@newUser
EXEC [DB2].[dbo].UpdateDomainUser_SP2_WithClaim @oldUser ,@newUser
END

Restore Database using Management Studio Express

Thursday, April 23, 2009

WITH (NOLOCK) directive in SQL

I am poor at DataBase level. luckly i have a requirement to work on SSRS2005. I used to see the existing reports , queries n i found new directive called WITH(NOLOCK) .
I had discussed with my RM n has cleared my doubts and explained senario(s) n Tips.
I would like to explain the summary .
"Same kind of reports r accessing multiple users in the bussiness hours.If i lock the records while retiving reports the remaining users should wait untill the task completion.Insted of that we r prefering WITH(NOLOCK) directive before a table in a query"
The following link is very useful for me.
http://blogs.neudesic.com/blogs/phil_scott/archive/2005/12/05/11.aspx