sql-server-2005

Storing Barcode values/Images in sql server 2005

One my web application uses barcodes.... When i add a new item i am generating a barcode value which is converted to a barcode image... My question What would you suggest storing barcode values or barcode images in sql server 2005? Which one would you suggest? EDIT: What Type of barcode you would suggest using with an asp.net appli...

Question regarding getting exclusive access to SqlServer database for restoring

Here's my problem: I have an application which uses sql server express 2005, and it is installed under default sql server express instance, SQLExpress Under this instance there are several other databases, used by other applications (web based or desktop) If I need to restore the database, sometimes it works, but sometimes it fails, tell...

How to get Microsoft SQL MATH POWER to show as decimal and not as INT (which it seems to do)?

I have this simple query: SELECT POWER(( 1 + 3 / 100 ), ( 1 / 365 )) According to MS SQL POWER(( 1 + 3 / 100 ), ( 1 / 365 )) = 1 when in fact it's 1,000080986 How to get Power to return Decimal instead of int. This topic seems similar to http://stackoverflow.com/questions/429165/raising-a-decimal-to-a-power-of-decimal but that on...

SQL server 2005 instance not found

I was using SQL server 2005 express edition and, therefore was limited by a data base 4 giga size. I decided to install SQL server 2005 developper (64bits) in order to be able to go beyond 4 gigabytes data base size. The installation program run with no error message on a Windows 7 64 bits, but did not install the SQL server Management ...

SQL Server performance - running ad-hoc queries versus compiled in a stored procedure

Is there any logical reason why a stored procedure would run very slow (>60 secs), but if I run the exact same code as a regular SQL script it would execute in less than 3 seconds? To my way of thinking, they should run the same, but that is not what I am seeing. I suspect there is something else going on, but wanted to see if anyone el...

SQL Server Top 1

In Microsoft SQL Server 2005 or above, I would like to get the first row, and if there is no matching row, then return a row with default values. SELECT TOP 1 ID,Name FROM TableName UNION ALL SELECT 0,'' ORDER BY ID DESC This works, except that it returns two rows if there is data in the table, and 1 row if not. I'd like it to always...

SQL Server 2005 - Multiple Databases

We are using SQL Server 2005 at work and when development started it was decided that multiple databases would be created. For example, we have one database for Individual say dbIndividual and another one for Translation say dbLocale. So far this has simplified the backing up and potential restore greatly as we just need to backup what...

SQL Server Table Owner - change the default

Is there something in SQL Server similar to USE (to switch databases) that can control the owner prefix that is used for tables? For example, we have an application that insists on creating tables "theServiceAccount.TheTableName" ; What we really want is to force it to put the table names under dbo... so "dbo.TheTableName" . We don't ha...

CF9 + SQL Server Express

I just created a new database in "Microsoft SQL Server Management Studio Express" and now I'm in "ColdFusion Administrator" and I'm trying to add my database as a Data Source. How do I do that? I believe the servername is .\SQLEXPRESS but I'm not sure what the default username and password are. I've tried creating a new login through Man...

How to insert,update and delete on currently

How to insert to multiple table, how to update one tables from it multiple tables and how to delete it multiple on currently? ...

SQL Server unique auto-increment column in the context of another column

Suppose the table with two columns: ParentEntityId int foreign key Number int ParentEntityId is a foreign key to another table. Number is a local identity, i.e. it is unique within single ParentEntityId. Uniqueness is easily achieved via unique key over these two columns. How to make Number be automatically incremented in the c...

UNION ALL Performance IN SQL Server 2005

Hello. I have a query with a long chain of CTEs which ends with SELECT RegionName, AreaName, CityName, SubCityName, StreetName FROM tDictionaryStreets UNION ALL SELECT RegionName, AreaName, CityName, SubCityName, StreetName FROM tDictionaryRegions The execution time of this query is 1450 ms. When I execute these 2 SELECTs separatl...

How do I make a sql job step quit reporting failure

Hi I have a sql job step like this Declare @Result varchar(255) exec myprocedure @Result = @Result output What I want to do: if @Result = 'Error' then mark the job as failed, how can I achieve that? ...

How to arrange values in ascnding order when single row is present

How to arrange values in ascnding order when single row is there...i mean i have only one row in my table for example prashanth 6 1 3 2 4 5 ...can we annage these velues in ascending order?... only one row is in the table.row number is 1....and we have 6 columns how can we arrange in ascending order..the values should come lik...

How to specify the name of a database to get the name of its tables using sql server 2005 syntax

I need to write a querry in SQL SERVER 2005 to get the name of the tables of a specified database name. So i need the syntax to specify the name of the database using SQL SERVER 2005. Does anyone have any idea ? Thanks in advance for your help. ...

T-Sql SPROC - Parse C# Datatable to XML in Database (SQL Server 2005)

Scenario I've got an application written in C# that needs to dump some data every minute to a database. Because its not me that has written the spec, I have been told to store the data as XML in the SQL Server database and NOT TO USE the "bulk upload" feature. Essentially I just wanted to have a single stored procedure that would take X...

Split Address column into separate columns in SQL view

I have an Address column in a table that I need to split into multiple columns in a view in SQL Server 2005. I need to split the column on the line feed character, chr(10), and there could be from 1 to 4 lines (0 to 3 line feeds) in the column. Below are a couple of examples of what I need to do. What is the simplest way to make this h...

Cannot set return value in variable in SQL Proc

Hi, I created a simple stored proc which returns a string create proc im.mmtest as select 'testvalue' go then I call the SP and set its return value to a variable. This block is executed by selecting all three lines and pressing F5. I do see the value when the exec statement is executed, but I do not get the string value back in sel...

Is it possible to set an index inside a XML column on SQL Server 2005 / SQL Server 2008?

Hi, I have an application that stores xml documents inside a column on SQL Server. The structure of the XML document is similar to the one below: <document> <item> ... <phoneNumber>0123456789</phoneNumber> .... </item> <item> ... <phoneNumber>9876543210</phoneNumber> .... ...

How should i modify this SQL select?

SELECT TOP (5) mydb.Te.TeamGR AS TeamInGR, Te_1.TeamGR, SUBSTRING(mydb.Data.AkrivesSkor, 1, 1) AS GoalsIn, SUBSTRING(mydb.Data.AkrivesSkor, 3, 1) AS GoalsOut FROM mydb.Te INNER JOIN mydb.Data ON mydb.Te.TeamID = mydb.Data.TeamInID INNER JOIN mydb.Diorganoseis ...