.sql file in sql server

  • why sql server uses .sql file?

    can I attach or detach .sql file to the sql server if yes then how?

  • It's just the default extension for a text file containing T-SQL code. A .sql file isn't a database.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • .sql is the extension of a script file not a database, its not an mdf/ndf/ldf file and thus cannot be attached or detached from SQL.

    The caveat to this is that if someone created the DB and specified upon creation that the file extensions should be .sql instead of mdf/ndf/ldf

  • The caveat to this is that if someone created the DB and specified upon creation that the file extensions should be .sql instead of mdf/ndf/ldf

    Shudder.

    If you haven't even tried to resolve your issue, please don't expect the hard-working volunteers here to waste their time providing links to answers which you could easily have found yourself.

  • Phil Parkin (11/19/2015)


    The caveat to this is that if someone created the DB and specified upon creation that the file extensions should be .sql instead of mdf/ndf/ldf

    Shudder.

    I once created a database with both the data and log files being NTFS alternate streams of a readme.txt. Just to see if I could.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • GilaMonster (11/19/2015)


    Phil Parkin (11/19/2015)


    The caveat to this is that if someone created the DB and specified upon creation that the file extensions should be .sql instead of mdf/ndf/ldf

    Shudder.

    I once created a database with both the data and log files being NTFS alternate streams of a readme.txt. Just to see if I could.

    I created a database with an extension of .DOC in a demo. Silly stuff is possible. Don't do that.

    "The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood"
    - Theodore Roosevelt

    Author of:
    SQL Server Execution Plans
    SQL Server Query Performance Tuning

  • Grant Fritchey (11/19/2015)


    GilaMonster (11/19/2015)


    Phil Parkin (11/19/2015)


    The caveat to this is that if someone created the DB and specified upon creation that the file extensions should be .sql instead of mdf/ndf/ldf

    Shudder.

    I once created a database with both the data and log files being NTFS alternate streams of a readme.txt. Just to see if I could.

    I created a database with an extension of .DOC in a demo. Silly stuff is possible. Don't do that.

    Indeed, just because you can, doesn't mean you should.

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply