sql-server-2008

BCP data export vs SSIS data export

I'm in the middle of amending our data export process and was wondering whether to create an SSIS package in order to export the data, or whether BCP is the "preferred" method? ...

Exporting from an old DB structure to new DB structure

I have inherited a database that has no real referential integrity at all, so I've created a new database with this corrected. The problem I have now, is that I have large amounts of data (around 50million rows) with previously assigned IDs. I need to keep these IDs in my new Database else I'll lose a lot of references from the data. ...

Should I save .pdf documents to the database or a folder that need to be searched

I have a bunch of PDF documents that I need to use in a website I am making. I do need to be able to search the PDFs as well. So is it better to save these files to the database or to a file folder? Also, in both cases how do I search them? I will basically be searching them for 1 or 2 words and return the list of PDFs that have the ...

advantages of sql management studio?

i just installed sql server 2008 express in order to learn microsoft sql. why should i install sql management studio express? is it much easier to use this GUI? ...

How to get SQL Server XQUERY to return something other than "There is no element named [Element]"

Apologies if this is answered elsewhere. I keep getting the error message XQuery [Mytable.XMLData.nodes()]: There is no element named 'Answer' SELECT ref.value('/','nvarchar(1000)') FROM Mytable CROSS APPLY xmldata.nodes('Answer') R(ref) - --XML of Row <Answer xmlns="http://TempNameSpace.com/AnswerData.xsd" Type="Deliverable"> <...

Debugging long dynamic sql in SQL Server 2008

Hi, I have some dynamic sql statement which bombs under certain conditions, so I am trying to debug it. it gets built like so: declare @sql varchar(4000); ... select @sql = '<part1>'; ... select @sql = @sql + '<part2>'; ... select @sql = @sql + '<part3>'; ... begin execute(@sql); select @ec__errno = @@error if @ec__errno != 0 b...

How to convert nested heirarchy of xml to sql table

Using MSSQL 2008 and XQUERY Consider the following XML stored in a table: <ROOT> <WrapperElement> <ParentElement ID=1> <Title>parent1</Title> <Description /> <ChildElement ID="6"> <Title>Child 4</Title> <Description /> <StartDate>2010-01-25T00:00:00</StartDate> <EndDate>2010-01-25...

Make MS SQL 2008 generate XML like MySQL 5.0?

A while ago I wrote an app that relied on XML coming out of a MySQL 5.0 database. It got this XML output by calling the mysql client directly, using the --xml command-line option; this made MySQL output XML that looked kind of like this: <resultset statement="SELECT * FROM tablename " xmlns:xsi="http://www.w3.org/2001/XMLSchema-instan...

Can I force Linq to Sql to use Sql2005Provider

This query (or rather one similar to it) is in a codebase we have already deployed. var timeblocks = from tb in DB.TimeBlocks where tb.StartDate.Date.AddDays(1) <= DateTime.Today select tb.Id; DB is a datacontext that connects to the database. TimeBlocks is a fairly simple table, StartDate is a DateTime column. Currently the...

SQL Server 2008, stored procedure run slow from code but fast in SSMS

Hello, I have a stored procedure that when I ran it from within the SSMS, it runs fast about 20 sec. but when I execute this same stored procedure from my .net application it takes about 50-70 secs!! Why is that happening? Thank you. ...

How does INSERT, UPDATE & DELETE work on a table partition?

How does INSERT, UPDATE & DELETE work on a SQL Server table partition? Technical explaination please how the SQL server engine handles table partition vs non table partition. ...

SQL Server 2008: How to show results all at once after query ends?

Hello, I want to ask if there is a way to show results (all at once) just after the query ends execution? In other words, I dont want to see "Partial" records on the way of query execution. Thank you. ...

sql server compatibility full text stoplists and noise words

if I am running sql server 2008 in compatibility level 90 (sql 2005) does it use the stoplist in the resource database or does it use ftdata\ENU.txt files??? also if I make my own stoplist in 2008 (using compatibility 100) can I ignore the system stoplist and use my own with my full text queries or will it use the system and my custom s...

File gets corrupted when reading/writting from SQLServer 2005/2008 from C#?

I've wrote two little methods to save and load .docx (and later on other type of files) files into database (SERVER 2005/2008 with VarBinary(MAX) as column). Everything seems nice but when i read the file back it's created but Word complains that it's corrupted but finally opens it up with everything in it. What's wrong with the code? ...

Using Visual Studio 2008 DBPro to convert database from Sql 2005 to Sql Server 2008

I have a DBPro database project that was created for Sql 2005. I am trying to build this on a different environment, with Sql 2008, and I am getting the following error: MSBUILD : Build error TSD158: An unsupported target database version was encountered. I couldn't find much on this error, and I am unclear what is the conflict. I have t...

Connecting PHP to Microsoft SQL Server 2008

Hi people, I used xampp for php and mysql. But i need to work with php and sql server 2008. can any body help me providing any link or tutorial that describes the configuration for php and sql server? Is there any software like xampp(php-mysql) that provides built in php-sqlserver? ...

Distance Algorithm used in SQL2008 for Geography Data Types

I am wanting to know what Algorithm SQL2008 uses when computing distance on Geography Data Types. There are several such Algorithms as the Haversine and Vincenty, however I have found no references for what SQL2008 is actaully using. ...

Is there a way to conditionally use default column values in an INSERT..SELECT statement?

I've got code similar to the following in a stored procedure that inserts a row into a table, I'd like to set the last column (FieldD) to @prmSomeValue unless it is null, otherwise just use the default value defined for that column. IF (@prmSomeValue IS NULL) INSERT INTO MyTable (fieldA,FieldB,FieldC) SELECT A,B,C FRO...

Why Microsoft abandoned Notification Services in SQL Server 2008 ?

I invested quite a bit of time toying with NS introduced in SQL 2005 and found it to be excellent feature.. However , I hear MS has abandoned NS in 2008; Why ? and with what they are replacing it if any at all.. ...

SQL CLR - Does lock statement make any difference?

Hello All, I have written the following piece of code ( sql clr stored procedure ) that writes messages to a local file. The problem occurs when multiple connections call the stored proc at the same time. So I used a lock statement. But this doesn't seem to make any difference? What am I doing wrong here? lock (SqlContext.Pipe) { S...