sql-server

Automatically replace dev database with live database?

I have live and dev versions of an ASP.NET website, with corresponding live and dev versions of the SQL Server back end. Each is on its own server (so 4 total) on the same local network. Every so often, we've been manually replacing the dev DB with the live DB, using backup & restore, so that the dev DB is a reasonably recent snapshot ...

Show Row Count in SQL Profiler

Is it possible to show a "Row Count" column in SQL Server Profiler? For example there are CPU and Duration columns but can it show how many rows a query returns? ...

Is it a good idea to put a print a trigger's name when it executes?

We put a print statement at the top, so when we're running a query in SSMS the messages tab shows me that more may be happening than initially meets the eye. Would there be much of a performance hit? ...

SQL Server 2000 sp_xml_preparedocument - To get innerxml/innertext of a node

I have some data like at the bottom. I use SQL Server 2000 stored proc to process this data using sp_xml_preparedocument . I would like to get the data within the node PartAuxiliaryID as it is below(the exact xml as it is, not the values or attribute) to a variable. What will be the best way to do that in stored proc using sp_xml_prepar...

Ranking before grouping problem in SQL Server 2005

HI, This should be easy but I don't understand enough about how grouping works. Basically I have 2 tables "Categories" and "Items" Categories ID CategoryName Items ID CategoryID ItemName Photo Score All I want to do is get 1 row for each category which contains the Category ID, the Category Name and the photo that belongs to the h...

SQL Server 2005: dynamically adding parameters to a stored procedure

Scenario I have a stored procedure that takes a single parameter. I want to update this stored procedure to take a VARIABLE NUMBER OF PARAMETERS - a number that I will never know. I currently use SQLConnections through a C# interface in order to pass in a single parameter to the stored procedure and return a result. The SQL Part Lets ...

SQL Server 2008 R2 CTP Installer crashes instantly after starting it

Hi, I'm trying to update my existing SQL server 2008 SP1 installation with SQL Server 2008 R2 (November CTP). I started the setup and chose the upgrade option and after some time the installer told me to reboot. As soon as I confirmed with OK, it crashed. After rebooting I can't even run the setup file anymore. it crashes instantly ...

SQL Server 2008 - Querying Spatial Data

Hello, I have a SQL Server database that I have migrated to SQL Server 2008. I want to take advantage of the spatial features. However my data is using more traditional data types. For instance, I have the following two tables: Location -------- ID char(36) Address nvarchar (256) City nvarchar (256) State char (2) PostalCode char (10) ...

Options for Non-Locking Messaging from within a SQL Server Transaction

I maintain a SQL Server-based application that requires us to send notifications of certain database changes to connected clients. These clients are fat-client C++ apps with high-bandwidth connectivity to the server. Up until this point, we've been using a dedicated messaging table in SQL Server which is updated via triggers on the rel...

Benefits Of Using SQL Ordinal Position Notation?

Background Information Ordinal position notation, AKA ordinals, is column shorthand based on the column order in the list of columns in the SELECT clause, instead of either the column name or column alias. Commonly supported in the ORDER BY clause, some databases (MySQL 3.23+, PostgreSQL 8.0+) support the syntax for the GROUP BY clau...

Problem running DELETE statement against linked server in SQL Server 2008

I'm having a problem running this query: DELETE FROM [IRPROD]..[BUDGET_USER].[GL_EXP] WHERE FISCAL_YEAR = 2010 IRPROD is a linked server to an Oracle 10g database. It's linked using the Oracle OleDB provider. There are ~79000 records that need to be deleted. Running this query it deletes 54. Running it again gives me this error messag...

Automated generation of database change scripts

I'm looking for a way to automated the generation of change scripts for our databases. Currently we use Visual Studio 2008 database edition, which has the Schema Compare option, but I don't see a way to automated those actions. What I'd like to do is create an old and a new database during my daily builds and have schema compare gener...

Is there an open source web based management for MS SQL server?

Does anyone know of a web based MS SQL manager (in ASP.NET or classic ASP)? I'm getting sick of using their studio software, and use MySQL a lot too, so I'm used to the web based management. Thanks :) ...

How do I drop a column with object dependencies in SQL Server 2008?

The error message I'm obtaining when trying to drop a column: The object 'defEmptyString' is dependent on column 'fkKeywordRolleKontakt'. Msg 5074, Level 16, State 1, Line 43 ALTER TABLE DROP COLUMN fkKeywordRolleKontakt failed because one or more objects access this column. I have already tried to find the default constr...

SQL Pivot and formatting Grid

I used pivot to get data in format Store department Employee Q1 Q2 Q3 ---------------------------------------------------------- abc d1 u1 1 Null Null abc d1 u1 Null 3 Null abc d1 u1 Null Null 2 abc ...

Asp.net Membership ProviderSql

Hi I'm looking into Asp.net Membership Providership Sql to determine if it fits my needs and have a few basic questions. It seems to create a lot of tables, many of them I don't think I need. I only need one application and no role management. Can I remove the unused tables or should I just leave them alone? I need another table wher...

Subscription Notification Service using SQL or .net?

I need some advice. I have to create a subscription notification service for my system. I need something that will be flexible where I can set some parameters to send out notifications on certain days (before a subscription is expired) and to set accounts to expired. I need something to run in the background that will send out these noti...

How to improve performance in SQL Server table with image fields?

I'm having a very particular performance problem at work! In the system we're using there's a table that holds information about the current workflow process. One of the fields holds a spreadsheet that contains metadata about the process (don't ask me why!! and NO I CAN'T CHANGE IT!!) The problem is that this spreadsheet is stored in a...

Are SQL Server Database Ids always positive?

Are SQL Server database Ids always positive? As in the dbid from sysdatabases. SELECT name, dbid FROM master.dbo.sysdatabases This question has nothing to do with identity columns or primary keys. ...

in my sql statement I call sum twice for the same argument, is it duplicating the effort?

consider my sql query below; it is calling sum twice for the same argument. IS this duplicating the work done by the server. Is there a better way to do this? SELECT Status_Detail_Code, count(*) as [Number of times assigned], round(sum(Duration)/60,2) as [total duration Hr] FROM dbo.V_TIMELINE WHERE (CADATE > N'...