sql-server

performance implications of filtering by a small set of ID's in a Where clause

Hi, I have a table with millions of rows in it. I want to add an Integer column (indexed) that is going to hold between 1-1000 unique values (in most situations probably less than 30). Will query performance be degraded substantially if my queries look like: SELECT * FROM MyTable WHERE GroupID IN (1, 123, 20, 30, 40) ...

Using XQuery in SQL Server 2005 to get XML Inner Text

How do I select the inner text of an XML node using XQuery? Microsoft Books Online shows how to retrive an attribute below: DECLARE @myDoc xml DECLARE @ProdID int SET @myDoc = '<Root> <ProductDescription ProductID="1" ProductName="Road Bike"> <Features> <Warranty>1 year parts and labor</Warranty> <Maintenance>3 year parts and labor...

Upgrade SQL Server 2000 from x86 to x64?

I have a SQL Server that's currently x86, and I'd like to upgrade it to x64. It's running on an x64 version of Windows, and I think it's as simple as the wrong version having been installed when the server was configured. It's a production server, so my biggest concern is getting the logins over unaltered, since every user has their own ...

SSIS: How To Use Deployment Utility Using A Single Package Configuration File

I am trying to create a deployment utility for a solution using a single package configuration file shared across packages. when I try to build the solution to create the deployment utility, the build process fails saying that the package configuration file already exists.... Any ideas ...

SQL Formatting Tool

So Visual Studio has a command like Format Document [Ctrl+K, Ctrl+D] is there something similar for SQL Management Studio? If not is there any other product out there, anywhere, that can help with this? We have hundreds of these we have to go through in a rather short time span, and as it we spend WAY to much time reformatting them due...

High volumn site using ADO.NET TransactionScope vs ExecuteCommand on NOLOCK, READ UNCOMMITTED directly?

Just read this interesting article by Omar on his blog Linq to SQL solve Transaction deadlock and Query timeout problem using uncommitted reads and at the end Javed Hasan started arguing with him about his solution to the nolock situation on a high volume site. Here, the problem trying to solve is, from the sql sense we need to use Se...

What is the best solution for migrating Linq DBML tables?

I'm trying to figure out the best way to deal with database updates with Linq. I'd like a clean way to checking database changes. I'd like to use a ruby style migration scripts, but I'd also like to keep everything in sync with the DBML file. What is the best way to do this? Do I need to write a custom solution to do this? ...

Efficient update of MySQL table from SQL Server

We have a MySQL database (mostly read-only, so MyISAM tables) living in the data center that talks to a SQL Server DB living on-site. There is some significant latency in the WAN (upwards of 100ms); in about 6 months the SQL Server DBMS will be moving up to the data center (e.g. same gigabit LAN). In the MySQL DB, I have several thousan...

Script Size Limit in SQL Server Management Studio

For example: how many lines of insert into foo ( '1','2' ) could one have in a file. I remember it being around 100k but searching with google has proved fruitless thus far. ...

Primarykey violation in restored database

Hi, I set up the transactional replication(not updatable subscriber) between sql server 2005 database. The tables in published database have identity columns. The tables were replicated without problem. But when I back up and restore the subscriber database, I could not insert row in a table which contains identity increment field and i...

Is there any way to enable Full Text Search on installed sql2008,without uninstalling it again

Is there any way to enable Full Text Search on installed sql2008,without uninstalling it again ...

SQL query - Join that returns the first two records of joining table

I have two tables: Patient pkPatientId FirstName Surname PatientStatus pkPatientStatusId fkPatientId StatusCode StartDate EndDate Patient -> PatientStatus is a one to many relationship. I am wondering if its possible in SQL to do a join which returns only the first two PatientStatus records for each Patient. If only one Patien...

NaN value in float field in MSSQL

I'm working on a java application,use double type to save value of unitprice,qty etc.I found some of these values show in MSSQL are NAN and throws infinite error when I try to reuse it.This is so unreasonable,I can save it but can not use it anymore!I think the NAN value in MSSQL must be valid when it first presence in java,so i can save...

How to enlarge image to normal size in ASP.NET 2.0

Hi My users uploads a picture and the picture get saved into my SQl Server Database My users view the picture on the page in a normal Image WebControl with size 150px by 150px - example can be found http://www.erate.co.za/CompanyProfile.aspx?ID=112 - the USA flag is the Image i am talking about. If the user uploads a picture of 300...

SQL Server not configured for data access

I m running an SQL Server 2005 database from a VB 6 Application. I connect to the database thro ODBC DSN. I renamed the computer on which Im running the a default instance of SQL server from 'Software' to 'IT' .I then run the 'sp_dropserver' & 'sp_addserver' stored procedures to rename the instance. On restarting the SQL server service...

Deploying / Creating Analysis Services Database using an ASSL Script

Im trying to deploy as Analysis Services database using an ASSL script. I can create the script using "script as" in management studio. But I can't find out how to run this script? ...

SQL Server 2000 command to disable user account

I need to disable some user accounts within a sql server version 2000. the following sql command is giving me an " incorrect syntax near 'Login' " error. The user name is valid and spelled correctly so I'm wondering if the command syntax is different for version 2000. ALTER LOGIN exampleuser DISABLE ...

How to set network adapter used by SQL Server Replication?

I have 2 servers running SQL Server 2005 with merge replication set up between them. Each server is connected to the building network, but they also have a cross-over cable connecting them creating a private network. How do I configure merge replication so it uses the private network and not the building network? The private network i...

MS-SQL: Convert all instances of one column type to another?

I have an SQL Server 2008 database, which contains about 40 tables. Most of them contain at least a couple of varchar columns, and I want to convert every single one of those to nvarchar (of the same length). Also want to convert a number of text fields to nvarchar(MAX). Is there a simple, straightforward way to do this? ...

Report based on arbitrary data source (quantity and names of columns may change)

I need to export data of all columns (including technical like GUIDs for foreign keys) of an arbitrary table from a given database. I wanted to use LocalReport class as suggested here, but I can't think of how to set up the report for an arbitrary data source (even quantity and names of columns may change). Any help would be appreciate...