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

How to Recover MSSQL from "Suspect Mode" / "Emergency Mode" / "Error 1813"

This article describes the course of actions you should take
  1. if your database somehow got "suspect mode" or "emergency mode";
  2. if you receive the error 1813 on attaching database

The History Behind 

I've been developing under SQL 7 for a while. Sometimes transaction log grew too large. My usual fix for that problem was:
  1. stop the server (on the development machine we do not need any logs), 
  2. delete transaction log
  3. start the server again
  4. after that the server was creating empty 1MB transaction log from scratch
I had been using this technique a lot of times under SQL 7, until sometime I have migrated to MSSQL 2000...
After my transaction log grew too large, I stopped the server, deleted the log file and started the server once again. However this time it did not worked: my database got "suspect". I was not able to read or write from the database. A week of work seemed to be lost... Ouch!...

Create a web service directly from Sql Server 2005 using an HTTP Endpoint (http://codebetter.com)

What is an HTTP Endpoint in Sql Server?  Well, it is a way to
create a usable interface using HTTP or TCP for SOAP, T-Sql, Service
Brokering and a few other things.  I’m just going to tell you,
quick and simple, about creating a web service to return data, although
you can return scalar values, messages and errors too.  The
results returned are serialized into Xml.  If you have Windows
2003, you don’t have to have IIS installed.  Sql server will use
the http.sys module in the Win2K3 kernel.
So lets look at creating a usable web service from within Sql Server.  Lets start with creating a stored procedure.
Create stored procedure to return list of employees