March 2009 - Posts

Cannot find template file for the new query

Be carefull when using cleanup tools which remove empty files from your system.
The application I used deleted files with 0KB sizes.

Apparently it also deleted files like C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\SqlWorkbenchProjectItems\SQL\SQLFile.sql which is 108 Bytes.

You can spot it from a 20 miles distance this is going to be major poo poo.
What was the impact removing that "SQLFile.sql" file?

I fired up SQL Server Management Studio and hit the New Query button and this popped up:

---------------------------
Microsoft SQL Server Management Studio
---------------------------
Cannot find template file for the new query ('C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\SqlWorkbenchProjectItems\SQL\SQLFile.sql').
---------------------------
OK  
---------------------------

I created an empty sql script file and named it SQLFile.sql. That's it!

Sigh...

Posted by Steve with 7 comment(s)
Filed under:

The DELETE statement conflicted with the REFERENCE constraint "FK_subplan_job_id"

I was 'trying' to delete an obselete SQL Server Agent job until this nice error popped up:

 

 

TITLE: Microsoft SQL Server Management Studio

------------------------------

 

Drop failed for Job 'Optimiser.Subplan_1'.  (Microsoft.SqlServer.Smo)

 

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.3239.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Drop+Job&LinkId=20476

 

------------------------------

ADDITIONAL INFORMATION:

 

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

 

------------------------------

 

The DELETE statement conflicted with the REFERENCE constraint "FK_subplan_job_id". The conflict occurred in database "msdb", table "dbo.sysmaintplan_subplans", column 'job_id'.

The statement has been terminated. (Microsoft SQL Server, Error: 547)

 

The solution:

 

use msdb

go

 

select * from sysmaintplan_subplans

 

delete from sysmaintplan_subplans

where subplan_name = 'Subplan_1' -- 'Subplan_1' in my case is the name of the subplan which is the culprit here

Posted by Steve with no comments
Filed under:

SQL Server Myths

I knew it!!

I noticed the following blog post the other day on SQL Server myths: http://sqlblog.com/blogs/paul_nielsen/archive/2007/12/28/sql-myths.aspx
We tend to take things for granted when reading blog posts. Aparently there is a lot of crap written about SQL Server on the Internet.
Man I sometimes can't believe what people write about indexes or transaction logs!

Who's right and who's not? Blogs are a great learning resource but I'd rather read from the great ones or buy a good descent book.

Posted by Steve with no comments