sql-server-2008

How to query SQL Server 2008 database for first and last name and order by relevance?

Basically I have a table like this: CREATE TABLE Person( PersonID int IDENTITY(1,1) NOT NULL, FirstName nvarchar(512) NOT NULL, LastName nvarchar(512) NULL ) And I need to find the top n results based on a user-query like this: "Joh Smi" The following query returns the results I need (I think). Just not in the relevant ...

Help with Pivot / Unpivot

I have a table as below Name Priority Date ------------------------- A 2 d1 B 3 d2 How to write a query to achieve the below output ColumnNames d1 d2 -------------------------- Name A B Priority 2 3 Thanks ...

SQL Server 2008 /2000 difference using as column name a reserved keyword

I could be not more sorry guys - the question was a very wrong one. As spotted by you the error is due to the fact that a colum with that name does not exists. The error and the post is due to a misalignement between a staging server and a production server. But the error has been detected by your answers, so many, many thanks The fol...

Connect to SQL Server 2008 with TCP/IP

I get the following error when I try to connect with TCP/IP from SQL Server Management Studio. I want a step by step description to solve my problem I don`t know what´s wrong? Cannot connect to =================================== A network related or instance specific error when a connection to SQL Server... (provider: Named pipe-prov...

Can I spread out a long running stored proc accross multiple CPU's?

[Also on SuperUser - http://superuser.com/questions/116600/can-i-spead-out-a-long-running-stored-proc-accross-multiple-cpus] I have a stored procedure in SQL server the gets, and decrypts a block of data. ( Credit cards in this case. ) Most of the time, the performance is tolerable, but there are a couple customers where the process is...

How can I get the bottom 50% of a select query in SQL server?

In SQL server I can say: Select top 50 percent How can I say bottom 50 percent? EDIT - for the sake of an interesting question, if we assume he has a table with a primary key but wants the bottom 50% ordered in ascending primary key order. What would be the most efficient way of achieving that? ...

Exposing web based XML data via a SQL Server view

It seems that SQL Server has a fair amount of XML support. Mostly I've seen info regarding storing XML in SQL Server, querying XML data stored in SQL Server, and exposing data as XML. Is the following scenario an option: I'd like to expose xml data (it's an RSS view of workitems) from a web site via a SQL Server view. The motivation is...

Report Builder 3.0

I'm using SQL Server 2008 (non-R2) and trying to use Report Builder 3.0. When I try to connect to the report server, I get an error: Connection Failed. Unable to connect to the server that is specified in the URL...... However, I am using the same connection as my Report Builder 2.0 and that works fine. Can RB 3 not work with ...

transfer SQL database (table and data)

hey all, iv created a database with some tables and populated them using SQL server 2008, i want to move the database to another machine, what would be the best way copy the database and recreate it in another location ?? by the way im connecting to localhost\SQLEXPRESS if thats important !! thanks ...

Three phases of recovery : the analysis phase, the redo phase, and finally the undo phase.

SQL Server database recovery consists of three phases: the analysis phase, the redo phase, and finally the undo phase. Can anybody please explain clearly or give a good link on these three phases of recovery?? ...

Local SQL Server 2008 Express data upload to Web based SQL Server 2008.

Over the next few months, we need to consider the best technology/technique for periodically uploading SQL Server 2008 Express data that is held on a local network up to a Web based SQL Server 2008 server. The idea is to allow us to consolidate the data in 20 distributed (local) SQL Server Express 2008 apps in use throughout the country...

Need sql server 2000 for win 7 64 bit

I have SQL server 2000 dev edition. But it isn't compatible with my new win7 pro 64 bit computer. Is there a free version of 2000 that I can install on my 64 bit pc for development? As I understand it, I can restore a 2000 database to sql server 2008. But I wont be able to restore the database back to the 2000 server after making any ch...

Storing statistics of multple data types in SQL Server 2008

I am creating a statistics module in SQL Server 2008 that allows users to save data in any number of formats (date, int, decimal, percent, etc...). Currently I am using a single table to store these values as type varchar, with an extra field to denote the datatype that it should be. When I display the value, I use that datatype field ...

Creating trigger in SQL Server 2005 (has to work in 2008 too) to prevent duplicates?

I have table that I insert data with following query (from c# code): INSERT INTO [BazaZarzadzanie].[dbo].[Wycena] ([KlienciPortfeleKontaID] ,[WycenaData] ,[WycenaTyp] ,[WycenaWartosc] ,[WycenaWaluta] ,[WycenaUzytkownik] ,[WycenaUzytkownikData]) VALUES (@varKlienciPortfeleKontaID ,@varWycenaData ,@varWycenaT...

Lists in User Defined Types (SQL Server 2008)

I'm trying to define a new type and have not had much luck finding any information about using lists within them. Basically my new type will contain two lists, lets say x and y of type SqlSingle (the user defined type is written in C#) is this even possible? If not how are you supposed to go about simulating a two lists of an arbitary l...

SQL Server - is it okay if I leave out setting up indexes and all during development?

And worry about it later like when I have few hundred records at least? ...

Sql Server 2008 Install

I already have Visual Studio 2008 installed. When installing developer Sql Server 2008, do I need to check the Business Intelligence Development Studio option? I'm guessing not. I assume if I already have VS 2008, the install will just add the relevant Sql Server related project types into VS 2008. EDIT: I marked the question answer...

Modify the Event Log Source name for an SSIS package

I have an SQL Server integration Services (SSIS) package using the standard Event Log provider (yes, the event log! I know we can use SQL etc...) The default "Source" of the log events is "SQLISPackage100" but I want it to be something like "AppName" so that the errors are more visible between the different packages when viewing the ev...

Full Text Index type column is empty

I am trying to create an index on a VarBinary(max) field in my SQL Server 2008 database. The steps I am taking are as follows: Table: dbo.Records Right click on table and select "Full Text Index" Then select "Define Index..." I choose the primary key which is the PK of my table (field name Id, type UniqueIndentifier). I then get the ...

What is an alternative to SQL Cursors

I have inherited a database that has a lot of cursors in it, and from what I have read, cursors and very slow and resource hungry. I'd like to remove these if possbile and replace with something else. I'm familiar with CTEs, but was wondering if a CTE inside of a WHILE 1 = 1 loop is a best practice or not? Any ideas? ...