Fix Your SQL Server

I wish that there is a switch which I can press when I am panicking and suddenly all the problems around me goes away. Well, there is no such switch available but there is indeed very similar solution. If you are facing problems with your SQL – continue to read on.

Here are the few of the questions I received every day and if you are facing the same problems than you are in indeed lucky as I know how to resolve them efficiently and quickly.

  • Your SQL queries are running slow.
  • Your database is corrupted and now you want to recover your data.
  • You just want to check that if your server is secure and protect it from intrusion.
  • You accidentally deleted your data and now have no idea how to recover it back.
  • You want to make sure that your server can handle your soon to be exploding business growth.
  • You want to setup your database backup and recovery strategy so your data is always safe and secure.
  • You want to set up your new SQL Server and you want to make sure that you have it setup right from the day 1.
  • You have plenty of data and have no clue how to gain new insight from it as well as understand business performance.
  • You want your data to bend, twist, fold and take the shape that satisfies your business needs and accelerate your business growth.
  • Your SQL Server was earlier running fine and now suddenly you it is very slow, unresponsive or just does not behave as it used earlier.
  • You are managing database designed few years ago and now want to create road map to to efficiently use all the goodness released in the latest version of SQL Server.

If you have faced any of the situation above and if you need help, I have a solution for you. My friends at Linchpin People are expert at Anything and Everything about SQL. Linchpin People are database coaches and wellness experts for a data driven world. Founders of Linchpin People have been focusing on the Microsoft SQL Server ecosystem for decades, helping companies succeed with data through technology, process, leadership, and most of all people.

You can reach out to me at pinal @ sqlauthority.com and I will hold your hand till you find the right expert at Linchpin People, who will see through that your database problem is solved. Alternatively you can directly reach out to them, if you prefer, just mention that you know me and Linchpin People will make sure that your problem is resolved on priority. Do not forget to check out their famous AnythingSQL and WellDBA service.

About these ads

88 thoughts on “Fix Your SQL Server

  1. Pingback: SQL SERVER – Transaction Log Full – Transaction Log Larger than Data File – Notes from the Field #001 | Journey to SQL Authority with Pinal Dave

  2. Pingback: SQL SERVER – Root Cause to Performance Problems – Notes from the Field #002 | Journey to SQL Authority with Pinal Dave

  3. Pingback: SQL SERVER – vCPUs – How Many Are Too Many CPU for SQL Server Virtualization ? – Notes from the Field #003 | Journey to SQL Authority with Pinal Dave

  4. Pingback: SQL SERVER – SQL Server Configuration Checking – A Must Do for Every DBA – Notes from the Field #004 | Journey to SQL Authority with Pinal Dave

  5. Hello,
    I facing sp long execution time getting records SkuSearch table having 2 crore records
    It takes 30 sec to execute bellow SP but when I write 3 query given bellow on separate panel with hard coded value it is executed within 1 sec.
    tell me what was the problem?

    ALTER PROCEDURE [dbo].[usp_getRelatedPartNumber] –exec usp_getRelatedPartNumber ‘8971A001′,’canon’,’13803031416′,’44103105′
    @strkey varchar(50),
    @mfr varchar(150),
    @strnsn varchar(50),
    @unspsc varchar(50)
    AS
    BEGIN
    set nocount on
    declare @strSubkey varchar(50)
    if(@strkey!=”)
    set @strSubkey=SUBSTRING(@strkey,1,((LEN(@strkey)/3)*2 ))
    –print @strSubkey
    –==========Start Retrive top 30 part number,Mfr Name =============–
    select top(30) SkuName,ProdName,ProdId,UPC,UNSPSC from dbo.SkuSearch
    where SkuName like ”+@strSubkey+’%’ and ProdName!=@mfr –order by NEWID()
    –==========End Retrive top 30 part number randomlly=============–
    –==========Start Retrive Valid Mfr Name based on input string=============–
    select top 1 ProdName,ProdId from dbo.Product
    where ProdName = @mfr
    –==========End Retrive Valid Mfr Name based on input string=============–
    –==========Start Retrive Valid part number desc based on input strings=============–
    select Top 1 SkuDesc from dbo.SkuSearch where ProdName=@mfr and SkuName=@strkey and UPC=ISNULL(@strnsn,’0′) and UNSPSC=ISNULL(@unspsc,’0′) order by SkuDesc desc
    –==========End Retrive Valid part number desc based on input strings=============–
    set nocount off
    END

  6. Pingback: SQL SERVER – Finding Frequently Running Query and Elapsed Time – Notes from the Field #005 | Journey to SQL Authority with Pinal Dave

  7. Pingback: SQL SERVER – Optimal Memory Settings for SQL Server – Notes from the Field #006 | Journey to SQL Authority with Pinal Dave

  8. Pingback: SQL SERVER – SQL Server Alerts and How to Use Them – Notes from the Field #007 | Journey to SQL Authority with Pinal Dave

  9. Create Person table
    PersonID (PK) INT NOT NULL
    FirstName VARCHAR(25) NOT NULL
    LastName VARCHAR(25) NOT NULL
    DateOfBirth SMALLDATETIME NOT NULL
    IsActive BIT NOT NULL

    Given the above table, write SQL statements that return:

    A. PersonID, FirstName and LastName of currently ACTIVE people sorted by LastName [A-Z] and FirstName [Z-A]

    B. DateOfBirth of the oldest person

    C. The number of people born in each month (NOTE: you need not worry about the year, only the month)

    • —————————————
      Create the table in SQL like so:
      —————————————
      CREATE TABLE [dbo].[Person]
      (
      [PersonID] [int] IDENTITY(1,1) NOT NULL,
      [FirstName] [varchar](25) NOT NULL,
      [LastName] [varchar](25) NOT NULL,
      [DateOfBirth] [smalldatetime] NOT NULL,
      [IsActive] [bit] NOT NULL,
      CONSTRAINT [PK_Person] PRIMARY KEY CLUSTERED
      (
      [PersonID] ASC
      )
      WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
      ) ON [PRIMARY];

      —————————————
      Insert some data like so:
      —————————————
      INSERT INTO Person VALUES(‘Fred’,’Flintstone’,’1900-04-25′,1);
      INSERT INTO Person VALUES(‘Wilma’,’Flintstone’,’1903-06-12′,1);
      INSERT INTO Person VALUES(‘BamBam’,’Flintstone’,’1925-09-13′,0);
      INSERT INTO Person VALUES(‘Barney’,’Rubble’,’1901-06-23′,1);

      —————————————
      Run the requested queries like so:
      —————————————
      A)
      SELECT PersonID, FirstName, LastName
      FROM Person
      WHERE isActive = 1
      ORDER BY LastName ASC, FirstName DESC;

      B)
      SELECT TOP 1 * FROM Person ORDER BY DateOfBirth ASC;

      C)
      SELECT Month(DateOfBirth), COUNT(*) AS ‘Nbr People Born’
      FROM Person
      GROUP BY Month(DateOfBirth)
      ORDER BY Month(DateOfBirth) ASC;

      -or-

      SELECT DATENAME(month,DateOfBirth), COUNT(*) AS ‘Nbr People Born’
      FROM Person
      GROUP BY DATENAME(month,DateOfBirth)
      ORDER By 2 DESC;

  10. Pingback: SQL SERVER – Overall SQL Server Performance – Not Just Query Performance – Notes from the Field #008 | Journey to SQL Authority with Pinal Dave

  11. Pingback: SQL SERVER – Tools for Proactive DBAs – Central Management Server – Notes from the Field #009 | Journey to SQL Authority with Pinal Dave

  12. Hello Sir,
    I need to shrink or reduce my database of 180gb. But when i try to shrink my database with 5Gb increments it is taking 4 hours for each iteration. What is the alternative to reduce the space used in db? Please advice. I am a developer with knowledge of sql server

  13. Pingback: SQL SERVER – Auditors, Passwords and Exceptions – Notes from the Field #010 | Journey to SQL Authority with Pinal Dave

  14. Dear Sir,

    I have installed SQL Server 2007 on windows 7 with following credentials
    Server Name: server
    Authentication: SQL Servef Authentication
    Username: sa
    Password:

    My problem is that the sa password is changed automatically. This occurs frequently. I do not know how to handle this. My applications won’t work if the password is changed.

    I don;t want to use any password for SQL server.

    Kindly, fix this issue.

    -Regards,
    Ravi Dethiya

    • Firstly, never use the SA account for applications. The SA account should always be disabled and not used. Second, there is no SQL Server 2007 :)

      Using no passwords makes no sense, this is not secure and as far as I am aware, impossible to do anyway. You should always have STRONG passwords for all accounts.

  15. Pingback: SQL SERVER – Check for Database Integrity – Notes from the Field #011 | Journey to SQL Authority with Pinal Dave

    • A view is a virtual table that consists of columns from one or more tables. Though it is similar to a table, it is not stored in the database. It is a query stored as an object, we don’t need extra space for views

  16. Pingback: SQL SERVER – Tools for Proactive DBAs – Policy Based Management – Notes from the Field #012 | Journey to SQL Authority with Pinal Dave

  17. Hi,

    I have a query, in management studio we are giving a connection string (host name for default instance) it just gets connected, how it is happening, is this instance name saved in file, where it goes and read this file or what actually happens in background when we press connect? can some one please explain?

  18. Pingback: SQL SERVER – Virtualized SQL Server Performance and Storage System – Notes from the Field #013 | Journey to SQL Authority with Pinal Dave

  19. Pingback: SQL SERVER – Learning SSIS – Where Do I Start? – Notes from the Field #014 | Journey to SQL Authority with Pinal Dave

  20. Log shipping has been set up new and is running fine. All on a sudden during the after hours, it starts failing. What could be the possible reasons?

  21. Pingback: SQL SERVER – Expanding Your Skills – Notes from the Field #015 | Journey to SQL Authority with Pinal Dave

  22. Pingback: SQL SERVER – Finding the Last Backup for All Databases – Notes from the Field #016 | Journey to SQL Authority with Pinal Dave

  23. Pingback: SQL SERVER – Dude, Where is the SQL Agent Job History? – Notes from the Field #017 | Journey to SQL Authority with Pinal Dave

  24. Hello Pinal,

    I am regular reader of your post and I am getting too much help from your blogs but right now
    I am really stuck to understand of use execute plan in ms sql server 2008. I want to compare two sql queries or statement for better performance is there any further way to know which one is best a sql statement which I have to put in my product.

  25. Pingback: SQL SERVER – Performance Statistic Collection – Notes from the Field #018 | Journey to SQL Authority with Pinal Dave

  26. Pingback: SQL SERVER – SSIS Data Flow Troubleshooting – Part1 – Notes from the Field #019 | Journey to SQL Authority with Pinal Dave

  27. Hi to Every one,i stocked with one query in which i need to insert a Arabic string in table for which i am writing trigger i am using instead of trigger on a table “Emp” when i am reeterview value i am unable to get arabic string instead i am getting “?????” .. when i try to append with N its working fine. so now my probelm is how can i append N for string for example
    set @str=’عربي/عربى’ now i am trying to assign another variable i cannot set @str1=n’عربي/عربى’ which is not possible i need a solution . thanx in advance

  28. Hi,
    I have a scenario where i am currently working Please find below the details.

    > I’m calling a function from stored procedure.

    I would want the below function to be modified as per the new logic mentioned at last.

    //** Function **//

    ALTER FUNCTION [dbo].[fn_XYZ]
    (
    @EndpointName VARCHAR(200)
    )
    RETURNS VARCHAR(200)
    AS
    BEGIN
    DECLARE @Participant VARCHAR(200)
    DECLARE @FirstPart VARCHAR(200)
    –Eliminating -, .,space if exists in begining of string
    IF LEFT(@EndpointName,1) = ‘-‘
    SET @EndpointName = REPLACE(@EndpointName,’-‘,”)
    IF LEFT(@EndpointName,1) = ‘.’
    SET @EndpointName = REPLACE(@EndpointName,’.’,”)
    IF LEFT(@EndpointName,1) = ‘ ‘
    SET @EndpointName = SUBSTRING(@EndpointName,2,LEN(@EndpointName)-1)

    —Conditions–

    IF @EndpointName LIKE ‘%STC99%’ OR @EndpointName LIKE ‘%STG%’
    BEGIN
    SET @Participant=’Audio’
    END
    ELSE IF @EndpointName LIKE ‘%DMA_VMR%’
    BEGIN
    SET @Participant=’UnKnown’
    END
    ELSE IF ISNUMERIC(REPLACE(@EndpointName,’.’,”)) = 1
    BEGIN
    SET @Participant=’UnKnown’
    END
    ELSE
    BEGIN
    –If there is no space in the string then consider full string as first part
    IF CHARINDEX(‘ ‘,@EndpointName) = 0
    SET @FirstPart=@EndpointName
    ELSE
    –Extract data before first space as First part
    SET @FirstPart=LEFT(@EndpointName,CHARINDEX(‘ ‘,@EndpointName))

    IF @FirstPart LIKE ‘%@%’
    –Extract data before @ in first part as participant
    SET @Participant = LEFT(@FirstPart,CHARINDEX(‘@’,@FirstPart)-1)

    ELSE
    –If there is no @ in first part consider first part as participant
    SET @Participant = @FirstPart

    END
    set @Participant= case when isnumeric(@participant) = 1 then ‘UnKnown’ else @participant end
    RETURN @Participant
    END

    2) After query run

    select distinct dbo.fn_XYZ(EndpointName) Participant,EndpointName from dbo.vw_ABCD
    order by Participant desc

    Results are as below:

    Participant EndpointName
    UnKnown 123 — As per the above condition —
    User1 User1 user5724 — As per the above condition —
    Krupa€™s Krupa€™s BlackBerry — As per the above conditions —
    Varun Varun Malhothra Singh — Require full name —

    Required:
    Varun Malhothra Singh as it is (with spaces) as ‘Participant’ with out making any changes to my above given conditions.

  29. Pingback: SQL SERVER – Index Fragmentation Next Steps – Notes from the Field #020 | Journey to SQL Authority with Pinal Dave

  30. Pingback: SQL SERVER – SSIS Execution Control Using Precedence Constraints – Notes from the Field #021 | Journey to SQL Authority with Pinal Dave

  31. Dear PinalSir,
    I am working on more than 150gb database. I have created clustered index and non-clustered indexes on tables of those fields which are using on order by, group by, where condition and joins. but still my database performance is very poor. please do the needful.

  32. Pingback: SQL SERVER – Say No to DB Data Roles – SQL Security – Notes from the Field #022 | Journey to SQL Authority with Pinal Dave

  33. Pingback: SQL SERVER – Finding Jobs Shrinking Database Files – Notes from the Field #023 | Journey to SQL Authority with Pinal Dave

  34. how to fix microsoft sql server error 233:A connection was successfully established with the server, but then an error occurred during the login process. (provider: Shared Memory Provider, error: 0 – No process is on the other end of the pipe.) (Microsoft SQL Server, Error: 233)—> in sql server 2012

  35. Pingback: SQL SERVER – Tools for Proactive DBAs – Central Management Server – Notes from the Field #024 | Journey to SQL Authority with Pinal Dave

  36. Pingback: SQL SERVER – Database File Names and Extentions – Notes from the Field #025 | Journey to SQL Authority with Pinal Dave

  37. I have this type of records.
    ID Name Uniq Id Date Value1 Value2 Value3 Value4 Value5
    1959 ABC 101 2/24/2014 2.6 30.9 2.0-3.0 15mg daily
    1959 ABC 101 1/27/2014 2.8 33.4 2.0-3.0 18mg daily
    1959 ABC 101 2/10/2014 2.5 30 2.0-3.0 5mg daily continue current
    386 EFG 102 1/27/2014 1.2 14 1.5-2.0 15mg everyday take extra 10mg
    386 EFG 102 1/31/2014 1.1 13.1 1.5-2.0 15mg daily have pt
    386 EFG 102 2/19/2014 1.3 15.7 1.5-2.0 have pt 20mg q day
    386 EFG 102 2/28/2014 3.3 40 1.5-2.0 20mg q day change coumadin
    394 XYZ 103 2/17/2014 2 23.6 2.0-3.0 5mg daily Coumadin 7.5 mg.
    429 XYZ 103 3/4/2014 2.3 28.1 2.0-3.0 20mg q day
    429 XYZ 103 2/11/2014 2 24 2.0-3.0 have pt
    429 XYZ 103 2/18/2014 2 24.1 2.0-3.0 Continue 5 mg
    429 XYZ 103 1/30/2014 2.1 25.1 2.0-3.0 Continue 15 mg
    429 XYZ 103 2/4/2014 3.1 37.7 2.0-3.0 CONTINUE

    Can you please help me i want to return this type of value in Procedure.
    ID Name Uniq Id Date Value1 Value2 Value3 Value4 Value5
    1959 ABC 101 2/24/2014 2.6 30.9 2.0-3.0 15mg daily
    1/27/2014 2.8 33.4 2.0-3.0 18mg daily
    2/10/2014 2.5 30 2.0-3.0 5mg daily continue current
    386 EFG 102 1/27/2014 1.2 14 1.5-2.0 15mg everyday take extra 10mg
    1/31/2014 1.1 13.1 1.5-2.0 15mg daily have pt
    2/19/2014 1.3 15.7 1.5-2.0 have pt 20mg q day
    2/28/2014 3.3 40 1.5-2.0 20mg q day change coumadin
    394 XYZ 103 2/17/2014 2 23.6 2.0-3.0 5mg daily Coumadin 7.5 mg.
    3/4/2014 2.3 28.1 2.0-3.0 20mg q day
    2/11/2014 2 24 2.0-3.0 have pt
    2/18/2014 2 24.1 2.0-3.0 Continue 5 mg
    1/30/2014 2.1 25.1 2.0-3.0 Continue 15 mg
    2/4/2014 3.1 37.7 2.0-3.0 CONTINUE

  38. Pingback: SQL SERVER – Good Value for Page Life Expectancy – Notes from the Field #026 | Journey to SQL Authority with Pinal Dave

  39. Pingback: Developer’s Life – Attitude and Communication – They Can Cause Problems – Notes from the Field #027 | Journey to SQL Authority with Pinal Dave

  40. what is large dump file & how should I stop the creation of large dump file(Dump file size grows up to 10 GB) and the reason for it’s occurrence in the SQL server?

  41. Pingback: SQL SERVER – SSIS Look Up Component – Cache Mode – Notes from the Field #028 | Journey to SQL Authority with Pinal Dave

  42. Pingback: SQL SERVER – Windows File/Folder and Share Permissions – Notes from the Field #029 | Journey to SQL Authority with Pinal Dave

  43. Sir, I am facing some problem with one of my windows application which is used by 500 user at a time .2%-4 % user’s application hanged because slow retrieval 28 rows from SQL Server 2008. What should i do?

    • Check Application dependencies / Components / Patches and software prerequisites…… from database part set the MAX memory size ,, right click on Instance >> properties >> Memory Tab>> then set max memory size as per the SQL Standard ,,,, if you have 32 GB Ram ,, then put 24000 on parameter ,,,, PUT the 1/3 memory part…. may resolve your issue….!!!

  44. Pingback: SQL SERVER – Parsing SSIS Catalog Messages – Notes from the Field #030 | Journey to SQL Authority with Pinal Dave

  45. I have two database on same sql server. I’ve created a Insert trigger on db1’s table named tbl1.
    Trigger checks the inserted values and based upon them, it insert/updates db2’s table named tbl2.
    It works perfectly.
    But sometimes it happens that data stops getting inserted into db1’s table tbl1.
    The moment I drop the trigger, all pending data gets inserted into db1’s tbl1 automatically.
    This happens often, I’ve checked the trigger many times, but couldn’t find the reason, why this happens.

    Any idea about this?

  46. Hi,, Can anyone suggest how to archive the Database , I have a scenario , where we are using 7 Year Old Database , and now we want to generate a Database backup from 1-jan-2014 to till date ,, we want separate 2 year backup , because we are not need old backup and its totally waste for us to maintain the performance of the Database……………. Please help me , how I Can Reduce the size of our database and perform the Archive to maintain data separately ,,,, we want our new database from 1-Jan-1014 to till date and rest of database we shell delete,,,,, please help ….???????????????????? Gaurav Chauhan.

  47. Pingback: SQL SERVER – Planned and Unplanned Availablity Group Failovers – Notes from the Field #031 | Journey to SQL Authority with Pinal Dave

  48. When I call a SP from ADO.Net it is taking more time (8 seconds), but when I run from SSMS it takes less than a second, any thoughts on the DB settings ARITHABORTH which influence this behaviour or any other solution.

  49. Pingback: SQL SERVER – SQL Server High Availability Options – Notes from the Field #032 | Journey to SQL Authority with Pinal Dave

  50. Pingback: SQL SERVER – Keeping MSDB System Database Lean and Fit – Notes from the Field #033 | Journey to SQL Authority with Pinal Dave

  51. Pingback: SQL SERVER – SSIS Component Error Outputs – Notes from the Field #034 | Journey to SQL Authority with Pinal Dave

  52. i tried to insert in table some rows but i don’t understand why some are inserted and other not inserted. the error message i got is : viloation on primary key.
    may you help me.

  53. Has anyone installed Sql server 2012 on windows 8 ..please help ..
    I have installed on windows 8 but am not able to look at configuration manager nor give the authentication details and run the database through .Net ..Please anyone can solve this issue..

  54. Pingback: SQL SERVER – Automate Database Operations for Success – Notes from the Field #035 | Journey to SQL Authority with Pinal Dave

  55. Hi,

    I am trying to post a string (xml) to an url

    EXEC @nval = sp_OAMethod @bj, ‘send’, NULL, @myString

    where I have declared @mystring as

    declare @mystring varchar(8000)

    and I am trying to create @mystring using a table at runtime where the @mystring value will exceed more than 8000 character and the string is truncating after character limit.

    Is there anyway where I can post the large file content either by storing the content in a variable or posting the file itself fetching from some location?

    I am doing this in sql server 2000.

  56. Pingback: SQL SERVER – What is Biml and How Can it Help Me with SQL Server BI? – Notes from the Field #036 | Journey to SQL Authority with Pinal Dave

  57. Pingback: SQL SERVER – Beginning Contained Databases – Notes from the Field #037 | Journey to SQL Authority with Pinal Dave

  58. Pingback: SQL SERVER – Andy Defines Basic RDBMS: Isolation in Processes – Notes from the Field #038 | Journey to SQL Authority with Pinal Dave

  59. Hi,
    I found out that one of my sql server 2005 table cannot be accessed.
    After running DBCC CHECKDB, get below error

    Msg 824, Level 24, State 2, Line 1
    SQL Server detected a logical consistency-based I/O error: torn page (expected signature: 0xaaaaaaaa; actual signature: 0x2). It occurred during a read of page (1:515924) in database

    Beside restoring the database is there any other best way to repair the issue?

  60. I create the oracle link server my test connection is success but i am not able to access the table the below error message i got from sql server

    Cannot process the object OLE DB provider “OraOLEDB.Oracle” for linked server indicates that either the object has no columns or the current user does not have permissions on that object.

  61. Pingback: Developer’s Life – Disaster Lessons – Notes from the Field #039 | Journey to SQL Authority with Pinal Dave

  62. Pingback: SQL SERVER – SSIS Parameters in Parent-Child ETL Architectures – Notes from the Field #040 | Journey to SQL Authority with Pinal Dave

  63. Pingback: SQL SERVER – ​Finding Out What Changed in a Deleted Database – Notes from the Field #041 | Journey to SQL Authority with Pinal Dave

  64. Hi sir
    Im uthaya kumaran from malaysia .I junior working in servers
    I wana ask some Questions regarding mirror hope you can help.
    1)IS THAT POSSIBLE MQSQL 2008 CAN MIRROR WITH MQSQL 2014
    2)IS THAT CAN USE STANDARD PORT TO CONNECT WITH MQSQL 2014.

    Thank you sir..i hope you will help to solve this problem to me .Im waiting for the answer from you thank you

  65. Pingback: SQL SERVER – Backing Up and Recovering the Tail End of a Transaction Log – Notes from the Field #042 | Journey to SQL Authority with Pinal Dave

  66. Hi Pinal,

    I am stuck at one point need your help, as i was looking for a place where I can post my query separately, but could not find it, so posting it here.

    I have created an extended stored procedure to fetch some data (it returns 2 columns) and that extended procedure is being called from an UDF. Issue occurs when I need to read the result columns of extended procedure to be used further in function.

    But I am not able to read the column values which i can store in variable and can be used further withing UDF.

    Can you please help me out, that how i can achieve it? Its little urgent as i am struggling because of this issue.

  67. I am able to take full backup through this query but unable to take differential and transactionl back please help me out

    DECLARE @MyFileName varchar(200)

    SELECT @MyFileName=’d:\1-backup’ + REPLACE(convert(nvarchar(20),GetDate(),120),':’,’-‘) + ‘full.bak’

    BACKUP DATABASE [LCMC] TO DISK=@MyFileName

  68. Pingback: SQL SERVER – Detecting Corruption with Suspect Pages Table – Notes from the Field #043 | Journey to SQL Authority with Pinal Dave

  69. Hi Pinal,
    We are using sql server 2008 sp2 for production.But since 2 days our sql server cpu usage is high like above 90-97%. So what we have to do to fix this, Please give me a solution as early as possible.
    Thanq in Advance.

  70. Pingback: SQL SERVER – The Basics of the SSIS Execute SQL Task – Notes from the Field #044 | Journey to SQL Authority with Pinal Dave

  71. Pingback: Hey DBA – Go Make a Proactive Investment Today! – Notes from the Field #045 | Journey to SQL Authority with Pinal Dave

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s