sql-server-2008

Could not find server 'dbo' in sys.servers

I have a lot of services which query the database. All of them work fine but one service calling a stored procedure gives me following error: Could not find server 'dbo' in sys.servers. Verify that the correct server name was specified. If necessary, execute the stored procedure sp_addlinkedserver to add the server to sys.s...

SQL Server Browser showing only hostname, not instance name

The title says it all. I just setup a new Windows Server 2008 machine with an instance of SQL Server 2008 Express. The SQL Browser service does not appear to be working correctly. In Management Studio, browsing for servers shows the hostname of the new server, but not the instance name. When you choose the hostname form the list it d...

SQL Server Agent - Can Job Ask Information About Itself

I don't suppose anyone knows whether a SQL Server Agent Job can ask information about itself, such as its own ID, or the path it's running from? I'm aware of xp_sqlagent_enum_jobs and sp_help_job but this doesn't help, because you have to specify the job ID. The idea is that we want code that we don't have to manage by being able to ca...

How to achieve multiple Active (read and write) sites(datacenters) with continuos datareplication using SQL Server 2008?

Hello, I need SQL to be running on 2 data centers(DC) active/active. There are tonnes of challanges to be done here and below are my requirements. Data synchronization must be async. (For higher performance) I need to be able to read/write on both DC When Site1 goes down, all the traffic will be routed to Site2 and when Site1 comes ba...

Relative Efficiency of JOIN vs APPLY in Microsoft SQL Server 2008

We're just starting to look at moving to SQL 2008 from SQL 2000 and are noting the new CROSS APPLY and INNER APPLY syntax that allows a form of 'joining' against either table-valued parametrized UDFs or correlated subqueries. Obviously it would be nice to be able to encapsulate logic in a UDF and be able to reuse it in different queries...

How to separate automatically populated tables from manually populated tables, properly, in SQL Server?

Lets say I have the following 2 tables in a database: [Movies] (Scheme: Automatic) ---------------------------- MovieID Name [Comments] (Scheme: Manual) ---------------------------- CommentID MovieID Text The "Movies" table gets updated by a service every 10 minutes and the "Comments" table gets updated manually by the users of the d...

How do I reorder/clear the connection history in SQL Management Studio 2008?

I connect to a lot of different servers in SQL Management Studio, but I find that not only is there no way to delete the old connections (dbnames, usernames, etc.), they also start to show up as duplicates. Is there any way to clear them/reorder the history? I can't seem to find any easy way. Thanks! Chris ...

MSSQLServer 2008 Management Studio Snippets

Is there a snippets feature in MSSQLServer 2008 Management Studio? ...

Strongly Typed Stored Procedure Resolution In VB.NET

Currently we generate classes in App_Code by returning all the sprocs from all of our databases and adding the correct parameter types and names to a SqlCommand object and then returning it in one giant class. This means we can do things like MyCmd.cmd.Parameters("MyParam").Value = "whatever" when we want to pass parameters to a SqlComm...

How to get a table storage information

SQL Server Edition: SQL Server 2005 w/ SP3 and 2008 Is there a built-in SQL Server stored procedures that will retrieve following information? Or a DMV (Dynamic Management View) would be great as well. I am interested mainly on how to find out FILEGROUP data of a table specifically. But it'd be better if there was a sproc that will ret...

SQL Server 2008 Merge Soft Delete Error

I'm trying to perform a soft delete on a row in my target table using the SQL server 2008 MERGE command. I think this should fall under the "when not matched by source" section, since the source is missing the row and the target still has it. All I want to do is set the IsActive bit to false, but I'm getting an error. "Attempting to s...

SQL Server 2008 Converting VARCHAR(50) to Uniqueidentifier

Hi! I'm trying to convert a varchar(50) column to a uniqueidentifier, but this error keeps popping up all the time, and i don't know why: "Msg 8169, Level 16, State 2, Line 1 Conversion failed when converting from a character string to uniqueidentifier." The data in the column is currently a valid uniqueidentifier. What's the proper...

Which are more performant, CTE or temporary tables?

Which are more performant, CTE or temporary tables? ...

Trouble setting up witness in SQL Server mirroring scheme w/ error

I've got a trio of Windows servers (data1, data2 and datawitness) that aren't part of any domain and don't use AD. I'm trying to set up mirroring based on the instructions at http://alan328.com/SQL2005_Database_Mirroring_Tutorial.aspx. I've had success right up until the final set of instructions where I tell data1 to use datawitness as ...

SQL Server Logging/User Tracking Capabilities

We have recently converted an Access Application to store the date on SQL server. The forms still reside in the MS Access, but are linked through file DSN's to SQL server. A question came up of the capabilities to track user activity within SQL server. I have speculated that if we set up individual users in SQL server and use these ind...

SQL Server 2000-2005-2008 Distributed Query Problem

Hello, Just set up a new server. Trying to transfer some workload from one to the other. Everything looks great, except when I come to run this code: CREATE TABLE #KEYWORD5 (ITEM_MASTER_ID NUMERIC(25) NULL) INSERT INTO #KEYWORD5 exec SQL2K801.soupftidx.dbo.P_REMOTE_SQL_EXEC 'SELECT IM.ITEM_MASTER_ID FROM ITEM_MASTER IM WH...

How do I clear the dropdown of logins from the sql server 2008 management studio conection prompt?

I've connected to a few databases once and only once and will never need to again, however they clutter up the dropdown of logins available to select. How can I reset the lists of servers and logins from the connection prompt in SQL Server Management Studio Express 2008? ...

What is the Auto-Close option when creating a new database in SQL Server 2008?

What is the Auto-Close option when creating a new database in SQL Server 2008? EDIT: and how do you decide whether to turn it on or off? ...

How do I write an SQL query which looks for a value in all columns and all tables in my database?

Hello. I'm trying to look for a value in my Microsoft SQL Server 2008 database but I don't know what column or table to look in. I'm trying to craft a query which will just look in all tables and all columns for my value. ...

Is there a silver bullet to importing XML data into SQL Server 2008 Express?

I've tried the Import/Export wizard, but there is no XML driver under the Data source drop down. Is there a way to import XML data into SQL Express without writing an app to do it explicitly? ...