sql-server-2008

how to record both success and fail in SQL Server Agent Job

Hello everyone, I am using SQL Server 2008 and I am writing a SQL Server Agent Job. In my Job, there are 3 steps and in each step I will execute a store procedure. I noticed that in default Notification setting, it write information to Windows event log only when it fails. My question is, any easy solutions to write both success and fa...

SQL Server agent job account issue

Hello everyone, I am using SQL Server 2008. I am confused about which account will be used when a SQL Server agent job runs. My confusions are, SQL Server agent as a Windows Service which we could control from Windows Service Management Console, from there we could set the account to run SQL Server Agent (LocalSystem in my computer); ...

How to start SQL Server agent jobs automatically

Hello everyone, I am writing PowerShell scripts to control SQL Server agent start/stop to ensure all the contained jobs runs according to defined schedule. I want to make sure that the only thing I need to do is to start the SQL Server Agent Windows Service, and then all the contained SQL Server Jobs will run automatically according to ...

Create SQL Server job automatically

Hello everyone, I am writing SQL Server deployment scripts which create SQL Server job automatically on a specific SQL Server server/instance. I have found that I can extract the sql statement which can be used to create SQL Server job automatically by using script job as => Create To. My confusion is that, I find the database name and...

Problem with merge replicated database and updating via tableadapter

Hi, I'm maintaining an old application. I'd to start a merge replication between two servers. But afterwards I get these error messages "Updating columns with the rowguidcol property is not allowed." Is there really now way to use the tableadapters for updating anymore? Do I have to refactor this application in order to be able to do a...

SQL 2005 - Search stored procedures for text (Not all text is being searched)

The following bits of code do not seem to be searching the entire routine definition. Code block 1: select top 50 * from information_schema.routines where routine_definition like '%09/01/2008%' and specific_Name like '%NET' Code Block 2: SELECT ROUTINE_NAME, ROUTINE_DEFINITION FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_DEFINI...

strange scripts generated by SQL Server when exporting a job

Hello everyone, I am using SQL Server 2008 Enterprise. I am using Management Studio -> Jobs -> Script Job as -> Drop and Create TO feature to generate related sql statement so that from another computer I can import the job. My question is, from the generated sql scripts, from the beginning there is output like this, there is a hard co...

Looking for T-SQL scripts to delete a SQL Job

Hello everyone, If I know the database server name, instance name and the SQL Server job name, how to delete a SQL Server job by its name in a simple way? I am writing scripts which will be called by sqlcmd to delete SQL jobs. Appreciate if anyone could show me a sample? :-) thanks in advance, George ...

Using SQL Server Express 2008 with SQL Server 2005 database -how to check for compatibility

I am using SQL Server 2008 express edition but I want to make my databases still in 2005. How can I set it up to only show features that a 2005 database can use? Like for instance I don't remember there being a "date" type. I only remember "dateTime". I don't want to be using features that 2005 can't support and I later on upload my db...

System.Data.SqlTypes.SqlTypeException: SqlDateTime overflow

I am working with C#.net and also SQL Server 2008. I have the following error, when trying to run a test unit within my project. System.Data.SqlTypes.SqlTypeException: SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM.. Database Table Column Name: createddate Type: datetime Default Va...

SQL Server Management Studio SSMS tries to "save to file" instead of execute on F5

This happens intermittently and seems to be related to accidentally hitting a key. Any ideas what causes this? ...

SQL Server: Check references when altering function/procedure signatures

One of my coworkers is working on a set of stored procedures, and changing the input parameters for one of them. This will break any procedure that calls that one, so we need to find all those procedures. Right now, we manually call a dependency finder script that looks in system tables for procedures that reference the one we changed. ...

sql server 2008 reads blocking writes

I have upgraded a set of databases from sql server 2000 to sql server 2008 and now large reads are blocking writes whereas this wasn't a problem in sql server 2000 (same databases and same applications & reports) Why? What setting in 2008 is different? Did 2000 default to read uncommitted transactions? (update) Adding with (nolock) to t...

Best way to get rid of unwanted sql subselects?

I have a table called Registrations with the following fields: Id DateStarted (not null) DateCompleted (nullable) I have a bar chart which shows the number of registrations started and completed by date. My query looks like: ; WITH Initial(DateStarted, StartCount) as ( select Datestarted, COUNT(*) FROM Registrations GROU...

SQL Server add job agent T-SQL script issue

Hello everyone, I am using SQL Server 2008 Enterprise. I have created a very simple test SQL Server Agent job which just print out a string. And then I add a schedule to let the job run once a day. Then I select from SQL Server Management Studio => Jobs => Select the test job => Script Job as => Drop and Create To, here is the generate...

import data from one table to another table

Hello everyone, I am using SQL Server 2008 Enterprise. I need to import all data from Server/Instance "Server Foo", Database "Foo" and table "Foo", into destination Server/Instance "Server Goo", Database "Goo" and table "Goo". Table Foo and Table Goo are of the same schema. If the same row exists for table Goo, I want to keep the origin...

What are the compelling reasons to choose SQL Server 2008 over 2005?

I'm investigating the possibility of upgrading our SQL Server from SQL Server 2000 to either 2005 or 2008. There's a lot of concern over whether or not 2008 is really ready for us to use because the database is so critical to our product. What are the compelling reasons to use 2008 over 2005? Have you had good or bad experiences with 200...

Sql Server 2008 and PHP - sqlsvr_escape_string?

I'm using php and sql server 2008 and the SQL Server Driver for PHP 1.0 does not have a similar escape string like mysql_real_escape_string. Do I just need to replace single quotations with something like function sqlsvr_escape_string($string) { $pattern = "'"; $replace = "''"; return(stripslashes(eregi_replace($pattern,$replace,...

Sql Server Composite Primary Key

I found something today in one of my databases that I cannot explain. I noticed on one of my tables that there was a foreign key made up of two fields which referenced the same two fields on the same table. These two fields were also the same two fields which made up the composite primary key. For example: Table: Listings Primary Key...

Best way to store large dataset in SQL Server?

I have a dataset which contains a string key field and up to 50 keywords associated with that information. Once the data has been inserted into the database there will be very few writes (INSERTS) but mostly queries for one or more keywords. I have read "Tagsystems: performance tests" which is MySQL based and it seems 2NF appears to be ...