sql-server-2005

Why doesn't SQL Server fail when the result of an UPDATE is ambiguous?

I have two tables, a destination for the update: create table dest (value int) insert into dest values (0) and a source: create table source (value int) insert into source values (4) insert into source values (1) If I run this query: UPDATE dest SET value = (select value from source WHERE 1=1) SQL Server fails with: Subquery re...

Connecting to SQL server2005 from ActionScript3

I want to connect to database SQL2005 from ActionScript3, where i need to execute query statements from actionscript! can any one tell me please the code to do that ???? i searched about this issue and the result did'nt help me as the code is not workinf so i got confused. ...

optimize for unknown for SQL Server 2005?

I was listening to the SO podcast and they mentioned Optimize For Unknown for SQL server 2008, they also mentioned that there was something similar for SQL Server 2005. Anyone know what this is? ...

Upgrade database from SQL Server 2005 to 2008 — and rebuild full-text indexes?

I upgraded from Sql Server 2005 to Sql Server 2008. I backed up the data in SQL Server 2005, and then I restored in SQL Server 2008. Next, I found the catalog under "Storage->Full Text Catalogs", and I right-clicked on it, and am trying to rebuild the Full-Text Catalog. The database is only 600mb. However, it keeps running for hours, and...

T-SQL query with funny behavior

Let's say you have the following two tables: X Table X_ID Y_ID_F X_Value 1 1 Q 2 1 G 3 1 T 4 2 W 5 2 K ... Y Table Y_ID Y_Value 1 A 2 B ... You want to query only those properties whose Y parent's value is A and update them so you write a query as follows (I realize there is a bette...

Finding duplicate records in SQL based on combination of fields

I have a project where a significant piece of the pie will be to identify where a record is duplicated in the database (Sql Server 2005). I know the obvious ways to find a duplicate record. However, in this case, we want to be fairly smart about the process. The table(s) will contain information about a prospective customer(lead). Th...

Getting rowsets from XQuery and SQL Server 2005

I can get the first record back from the code below in SQL Server 2005. How do I get them all? If I remove the '[1]' index I get some singleton error... declare @xml xml set @xml = '<my:myFields xmlns:my="http://schemas.microsoft.com/office/infopath/2003/myXSD/2009-03-16T20:13:11"&gt; <my:field>test1</my:field> <my:field>test2</my:fie...

How do you add Foreign Key Relationships?

I'm working with an existing SQL 2005 database that was not implemented with FK relationships between tables. I tried to add the relationships with a database diagram and my application immediately blew up trying to edit or insert any data that is tied to the new FK. dbo.person [person_id | firstname | lastname | dateofbirth] dbo.campa...

How to install SQL Server 2005 Express as NOT US English

Does anyone know how you can get SQL Server 2005 Express to NOT install as US English? All my win2k8 Regional Settings are set to English(New Zealand) but it always installs as US English. I can't find anywhere to change it in the installer. ...

How can I script an MS SQL Server database with proper object ordering?

I'm trying to script an MS SQL Server 2005 database to a single file. So far I've tried using SQL Management Studio and the MS Database Publishing Wizard. Both tools will script the database objects without a problem although neither tool is scripting objects in the right order of creation. For instance the script might script a view ...

How to SELECT * INTO [temp table] FROM [Stored Procedure]

How do I do a SELECT * INTO [temp table] FROM [Stored Procedure]? Not FROM [Table] and without defining [temp table] ? Select all data from BusinessLine into tmpBusLine works fine. select * into tmpBusLine from BusinessLine Trying the same, but using a stored procedure that returns data, is not quite the same. select * into tmpBusLi...

SQLDatasource CommandTimeout not working

Good day, I'm using a SQLDataSource with a dynamic query generated c#, based on user choices in many fields. However, since our tables are very large, sometimes, I get a command timeout exception. I tried to set the property in 'Selecting' of the SqlDataSource like so: protected void SqlDataSource_PSearch_Selecting(object sender, Sq...

Running SSIS packages in separate memory allocations or increasing the default buffer size?

I have a SSIS package that has a child package that is failing. The error message isn't very helpful. The attempt to add a row to the Data Flow task buffer failed with error code 0xC0047020 The problem seems to be I am running out of Virtual Memory to complete the job. I found a forum thread that may help solve the problem. http:...

Weird SQL Behavior, why is this query returning nothing?

Assume there is a table named "myTable" with three columns: {**ID**(PK, int, not null), **X**(PK, int, not null), **Name**(nvarchar(256), not null)}. Let {4, 1, аккаунт} be a record on the table. select * from myTable as t where t.ID=4 AND t.X = 1 AND ( t.Name = N'аккаунт' ) select * from myTable as t ...

converting rows into columns in t-sql - sql server 2005

I have situation that I have a table in the structure ID, name 1, 'value1' 1, 'value2' 2, 'value3' 2, 'value4' 1, 'value5' I wanted to show the above data in following format id , combineName 1 ,'value1','value2', 'value5' 2 ,'value3','value4' Is there an easy way to do this in SQL Server 2005, or will I have to run cursors ...

SSRS 2005 Report Automatically Rendering

I have created a number of SSRS 2005 reports, and provided a number of parameters for each. Each of the parameters have default values, and therefore the report automatically renders when someone visits the report through the SSRS web site. What I'd like to do is have all the reports have their default values, but prevent the report fr...

SQL Server - how to use 'ALTER INDEX' with variables as the parameters

Using T-SQL I've found that I can't use 'ALTER INDEX' with the table/index values in variables without getting a syntax error. Is there some way this could be done ? I'm on SQL Server 2005. My code looks like this : DECLARE @TABLENAME VARCHAR(256) DECLARE @IDXNAME VARCHAR(256) DECLARE @SCHEMAID INT SET @TABLENAME = 'T1' SET @IDXNAME = ...

How can I delete or select a row from a table that has a specific row number?

I have a question about Microsoft SQL Server 2005. How can I delete or select a row from a table that has a specific row number? ...

Select item from a string of items

I have a string of email recipients in the format like this: DECLARE @recipients VARCHAR(MAX); .... PRINT @recipients; /* the result [email protected];[email protected];[email protected];... */ "SELECT DISTIECT ..." is a simple and powerful SQL statement, but it works against a table. Is there a simple way to select distinct r...

issue performing a very specific SQL query to place data in a different format

Hello, I am having some trouble dealing with an SQL table that needs to be queried and re-formatted into another table for reporting purposes. Here's the initial table: id int, logtimestamp datetime, serialnumber varchar(255), robotid int, amountconsumed float The robotid's are only from 1 to 4. Eve...