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

Thursday, August 19, 2010

Stop whining list




  1. FreeNas...

  2. Windows 2008 R2 2 node Cluster build

  3. IIS 7.5

    1. php.iis.net

    2. WordPress 3.0 Post Setup

    3. mySQL - with phpmyadmin



  4. SQL 2008 R2 Enterprise cluster build

    1. Majority node set with cluster, witness server

    2. Shared disk with quorum from iSCSI Target from FreeNAS



  5. Self-Signed certs (SSL)

  6. ISA - 443 to 80

  7. RDP default port add/change - entry on http://d.patrickoneill.com/?p=83

  8. MOSS 2007 to MOSS 2010 upgrade/migrate

  9. get patches for Mom's computer :)

Friday, August 6, 2010

To put the entire SQL server into single user mode

This is for SQL2005, for SQL 2008, you will need to change the directory where the sqlservr.exe file is located.




Open Cluster Admin - stop SQL services

open cmd prompt and type (or copy/paste) the following:

cd "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Binn"

sqlservr.exe /s SQL1 /c /m /T3608

- you will see a bunch of stuff fly by on the cmd window, this is normal

start SQL Management Studio

Click CANCEL! on the connection prompt

Click New Query - then select your database from the drop list (it's right under the New Query button)

Paste in your DB reindex t-SQL script in the query window and execute

Set a database into Single User Mode











ALTER DATABASE [URSTUPIDDATABASE] SET MULTI_USER WITH NO_WAIT


ALTER DATABASE [URSTUPIDDATABASE] SET SINGLE_USER WITH NO_WAIT







or





EXEC sp_dboption 'URSTUPIDDATABASE', 'single user', 'false'

EXEC sp_dboption 'URSTUPIDDATABASE', 'single user', 'true'


Thursday, August 5, 2010

t-SQL to allow comments and ping backs on all your posts

If you want to update all of your posts in your Word Press blog site from closed commentsand closed pingbacks, then you can run this update script to update all of your posts to allow comments and pingbacks. Log in to your PHPMyAdmin where your database for your site lives, select the database, then select Query and insert the following, then click Go. :)
UPDATE wp_posts
SET Comment_Status = 'open',Ping_Status = 'open'
WHERE ID > 0

NOTE: Now, sometimes, when these SQL queries are placed in block-quotes, the single quotes get all weird and you might have to re-type them.