sql-server-2008

How can i import indexes into ms SQL Server?

I created a new databases , and added tables using the import data wizard. But the wizard din't create the indexed and constraint's on the table. How can I Import indexes? ...

Splitting comma delimited cell data

I have a spreadsheet with multiple columns, one of which is an owner_id column. The problem is that this column contains a comma delimited list of owner id's and not just a single one. I've imported this spreadsheet into my sql database (2008) and have completed other importing tasks and now have a parcel_id column as a result of this p...

Cross-database view permissions

I'm working with a database (let's call it DB_data) that contains all of the tables for a series of applications. In an attempt to minimize downtime during upgrades, a facade database (let's call it DB_facade) has been created which has a view for each of the tables in DB_data. It also contains all of the functions and stored procedures,...

Shredding XML Data into Tables

I have an issue where I must shred multiple xml datasets from multiple providers into a single set of tables by mapping various elements in the sources to my own tables. I can do this just fine when I am gathering the top level information, but some of my information is in a collection, such as the categories. My first step is just to ...

SQL Server XML: massage xml format outside of SQL or within SQL stored proc?

Hi everyone, I have read through some excellent responses already dealing with SQL XML output posts, although what I need might not be a) best to do within a stored proc and b) not possible within a stored proc. My question is this: I have a simple table; col1, col2, col3, col4 .. for the purpose of an example, they are all just varch...

SQL Timeout and indices

Changing and finding stuff in a database containing a few dozen tables with around half a million rows in the big ones I'm running into timeouts quite often. Some of these timeouts I don't understand. For example I got this table: CREATE TABLE dbo.[VPI_APO] ( [Key] bigint IDENTITY(1,1) NOT NULL CONSTRAINT [PK_VPI_APO] PRIMARY KEY, ...

Change SQL Server Maintenance Plan Report Location?

I created some Maintenance Plans in SQL Server 2008 without using the wizard (i.e. right-click on Maintenance Plans and select New Maintenance Plan...). When created that way, there is no option to specify the location for the Maintenance Plan Action Report. It is by default placed in the Log subfolder of the Program Files folder for tha...

sql server express 2008 problems

We just recently switched from Visual Studio 2008 to Visual Studio 2010. I have an application which uses sql express database locally. The problem is after installing new Visual Studio, I can't access the Sql Server 2008 express. When I try to create a new database, or change the existing one, I get following message: A network-rela...

Horizontal scaling SQL Server 2008

Is it possible to somehow horizontally scale an SQL Server 2008 database to allow for performance increase by adding extra servers to a cluster? Thank you ...

SQL Reporting Services 2008 compared Crystal Reports?

I'm in the process of deciding whether to use SSRS or CR for our reporting needs. I have read through several discussions, including Crystal Reports vs. Microsoft SQL Server Reporting Services and Compare SQL Server Reporting Services to Crystal Reports. All very good and valid points. The over-all consensus seems to be that SSRS is a...

t-sql stored procedure create scripts

Hi I have a bunch of stored procedure names. I want to export the create script for each of the stored procedure. What is the best way to do it? Right now I am manually selecting the stored proc in SSMS and selecting "Script stored procedure as -> Drop and Create to". This seems tedious. I am hoping there is a better way to deal with ...

Union all geometry in a SQL Server table like GeomUnion in Postgres

Just to clarify up-front: I'm talking about unioning geometry, not the SQL keyword UNION. I'm trying to move some spatial data from Postgres with PostGIS to SQL Server 2008. It was fine until I saw a statement like this: SELECT GeomUnion(the_geom) FROM some_table This unions all geometry in that column and return it as one result (si...

Creating a New Database from Within a Stored Procedure

Due to an employee quitting, I've been given a project that is outside my area of expertise. I have a product where each customer will have their own copy of a database. The UI for creating the database (licensing, basic info collection, etc) is being outsourced, so I was hoping to just have a single stored procedure they can call, p...

Sql Server - Merging large tables without locking the data

I have a very large set of data (~3 million records) which needs to be merged with updates and new records on a daily schedule. I have a sproc that actually breaks up the recordset into 1000 record chunks and uses the MERGE command with temp tables in an attempt to avoid locking the live table while the data is updating. The problem is...

How to run .sql file from a batch file?

I am running sql server 2008 express and i need to schedule some stored procedures to run nightly...so i have built out these .sql files which i would want to run from .bat file...i need to know the command to execute these .sql files one by one and store their results i guess...can anyone help me out? ...

Changing SQL Server collation to case insensitive from case sensitive?

I've recently installed SQL Server 2008 and I selected collation as case sensitive. I want to make it case insensitive for the entire instance (not for a database in that instance). If I change the collation does it affect any existing databases? if so in what way? ...

Calculate time difference (only working hours) in minutes between two dates

I need to calculate the number of "active minutes" for an event within a database. The start-time is well known. The complication is that these active minutes should only be counted during a working day - Monday-Friday 9am-6.30pm, excluding weekends and (known) list of holiday days The start or "current" time may be outside working ho...

Database backup in SQL Server 2008

How can i check with SQL query whether Database backup JOB is created or not ? Thank You ...

SQL Trigger + CLR SP vs CLR Trigger

Are there any benefits to call CLR SQL stored procedure from regular trigger rather then deploy CLR trigger straight away? I need to be notified on specific column change (StatusID) in very large table. Currently a number of windows services is used. Each monitors its own StatusID, i.e. quires db for specific StatusID: SELECT a,b,c FRO...

SQL Server Web Synchronization replication with an IP address

Hi All, Does anyone know if its possible to set up web synchronization with SQL Server 2008 and IIS7 to use just an IP address if we have an SSL bound to an IP address rather than a fully qualified doman name? Eric ...