Thursday, July 5, 2012

What is NOLOCK Hint in SQL server ?

Using the NOLOCK query optimiser hint is generally considered good practice in order to improve concurrency on a busy system. When the NOLOCK hint is used in a SELECT statement, no locks are taken when data is read. The result is a Dirty Read, which means that another process could be updating the data at the exact time you are reading it. There are no guarantees that your query will retrieve the most recent data.  SELECT statements take Shared locks, means multiple SELECT statements are allowed simultaneous access, but other processes are blocked from modifying the data. The updates will queue until all the reads have completed, and reads requested after the update will wait for the updates to complete. The result to your system is delay(blocking).

The slight disadvantage is that one may not be sure that they are getting the data which is currently being updated in the Table ie Without lock protection, you cannot be guaranteed that the data isn’t changing during the time that the query is running.


How to use:
SELECT * FROM TableName (NOLOCK)

Friday, January 27, 2012

Steps to Deploy Report Model Into Production Server.

 Note :
1.First Deploy the .smdl File into Local Server(http://localhost/reportserver) and then download the .smdl file in to folder(send downloaded files as a deliverable).
2.All tables related with report model should be present  in the data base.

1.Create the DataSource inside the "data Source" folder
                1.1 Click On "New data Source" tab.
                1.2 Give the New data Source Name(.dsv)
                1.3 Data source type: microsoft sql server
                1.4 Connection String:Data Source=<machine name>;Initial Catalog=<db name>;
                Example:Data Source=A648;Initial Catalog=database_Name;
                1.5 check Windows integrated security.
                1.6 Test connection.
                1.7 Apply
2.GO to "Models" Folder
               2.1 Upload the .smdl file
               2.2 Right click-->Manage-->Data Source-->browse the data source.
              2.3 select the data source inside the "data source"Folder.

3.Upload the RDL File.
               3.1 Right click-->Manage-->Data Source-->browse the shared data source.
               3.2 select the data source inside the "Model"Folder.

Tuesday, January 10, 2012

Error,while restoring the database in MS SQLserver 2008R2

Error: “The file “C:\Program Files\Microsoft SQL Server\MSSQL.2\MSSQL\DATA\mastlog.ldf” is compressed but does not reside in a read-only database or file group. The file must be decompressed.”


solution1:Opened my mdf file properties dialog box, and in the advance tab the problem was revealed: the “compress content” checkbox was checked.
After unchecking and saving changes, SQL Server accepted the attach with no problem whatsoever.
solution2:Check the drive where data base is going to restore.Right click the Drive(C: Drive)--> Property-->General-->Compress this drive to save the disk space(it should be unchecked )