sql

Build XML Off of Common Table Expression

Hi All, I am using a CTE to recurse data I have stored in a recursive table. The trouble is I am trying to figure out how I can use "FOR XML" to build the desired xml output. I have a Table of Contents table I am recursing and I want to be able to use that data to generate the XML. Here is an example of what the data is simliar to: ...

SQL Subqueries COUNT CASE

I'd like a SELECT query to return specific value if the count of a nested subquery is 0 ... SELECT ( SELECT (CASE COUNT(*) = 0 THEN 'TRUE' ELSE 'FALSE' END) FROM List WHERE Status = 1 AND Deleted = 1 ) AS Status This does not work what is wrong with this syntax? ...

how to insert values tosqlserver 2000 via asp by connection string

..................... ...

how to get field name what are the field have value?

i have one table sql server like below , from that table i want to get quesno, field name[what are the field have value] QuesNo A B C D 1 1 0 1 0 2 0 0 0 1 Output : QuesNo Result 1 A,C 2 D Is there any possible ways to get outpu? ...

Retrive SQL data on dynamic created textbox

I am using C#, Visual Studio 2005 I have created textbox on runtime/dynamic way and inserted/saved sql data on database but the problem is how to retrive the same data on same way for edit / update. e.g. col1 col2 mahesh 1000 kirti 2000 the above data stored in sql server. I don't know how t...

how to load the mp3 song and display it in aspx webpage???

i got the mp3 file read as byte[] from the database. how to show this byte[] /assign to which control to make the mp3 load and play in aspx webpage.how to load the mp3 song and display it in webpage??? or. how to download the file???? ...

How to Alter Mulitple Columns datatype in SQL Server

I have 10 columns in a table and i need to alter the datatypes of that columns so how should i go with it i had tried for this - ALTER TABLE tblcommodityOHLC alter column CC_CommodityContractID NUMERIC(18,0) ,CM_CommodityID NUMERIC(18,0) for single is fine - ALTER TABLE tblcommodityOHLC alter column CC_CommodityContractID NUMERI...

Migrating a database from MS SQL to MySql - How time consuming / difficult is it?

A client wants a database converting from MS SQL to MySql. Personally I wouldn't do this, I prefer MS SQL for larger databases and like the tools available when working with MSSQL. However I do use MySql on smaller projects. I've never moved a database from one to the other, or made much use of sprocs when using mysql. Is there a lo...

Hierarchical MAX

Is there a way to get a row that has the MAX() when two fields are considered, giving one of them precedence. For example ID Column_A Column_B ---------------------------- 1 1 3 2 3 2 3 2 2 4 3 1 Would return ID Column_A Column_B --------...

Problem Error Handling in Stored Statement?

Here is my stored procedure on updating records : ALTER PROCEDURE [dbo].[sp_UpdatetoShipped] ( @Date datetime, @SerialNumber varchar(50), @User varchar(50), @WorkWeek varchar(50) ) AS BEGIN UPDATE dbo.FG_FILLIN SET Status='SHIPPED',DateModified=@Date,ModifiedBy=@User,WorkWeek=@WorkWeek where (Status='KITTED')and SerialNumber=@SerialNu...

SQL: How to fill empty cells with previous row value?

I need to produce the column "required" in the following table using SQL without using loops and correlated sub queries. Is this possible in SQL 2008? Date Customer Value Required Rule 20100101 1 12 12 20100101 2 0 If no value assign 0 20100101 3 32 32 20100101 ...

Converting String (in Eastern Daylight Time format) to Date in SQL

Please I need help on how to convert this string [ Fri Jun 19 10:45:39 EDT 2009 ] that is in EDT date format back to Date in SQL (Am using Postgres). I want to be able to have something like this 19-06-2009 Thanks ...

Search memo field using space-separated keywords?

given the following test records ID, MemoField 1, "apples oranges mangoes peaches" 2, "oranges bananas apples" 3, "oranges plums cherries" 4, "bananas cherries kiwi" and having keywords entered in a single text field as: "apples oranges" I want to be able to return records 1, 2 and 3 because those records either contain apples or ...

SQL Server query question

Hi all, I have a table Orders with (id,orderCode,productId,quantity,color,size) where I can have entries like: 1,O20100812,163,2,BLUE,Medium 1,O20100812,163,3,BLUE,Larger 1,O20100812,145,4,RED,Large etc 1,O20100815,134,5,RED,Large etc 1,O20100815,143,2,BLACK,Large etc 1,O20100815,112,8,BLACK,Large etc And another table Products with ...

How to connect sql developer to a database on localhost? instance=sqlexpress, db name = Equipment

Oracle SQL Developer Version 2.1.1.64 Database created in MS SQL Server management studio 2008. computer name: server instance: sqlexpress DB name: equipment No security, or windows security I guess. what do I enter in the following sql developer fields: hostname, port, SID/service name. ...

How can I use an SQL statement stored in a table as part of another statement?

In our Oracle datbase we have a table called RULES, with a field called SQLQUERY. This field is a varchar with an SQL statement stored. The PK is DM_PROJECT. A typical statement that is stored could be select ACCOUNTNUMBER from CUSTOMERS where ACCUMULATED_SALES > 500000 I want to do something like this: select * from customer...

Database Storage of Dynamic Methods in C#

How can I store C# methods in a sql server instance to be loaded and run dynamically (at runtime) at a later date? I am about to begin a production test project at work where I would like the appropriate test methods for the product to be loaded at runtime. I have looked at Reflection.Emit DynamicMethod briefly but it is not serializab...

transposing a table

Hi I would like to rotate a full table: LANGUAGE litAccept litDelete litErrorMsg .............. ------------------------------------------------- SPANISH Accept Delete Error has ocurred ENGLISH Aceptar Borrar Ha ocurrido un error ..... into something like this: LANGUAGE ENGLISH SPANISH ----------------------------...

python generate SQL statement keywords by given lists

Hi ALL, I have below variables try to make an auto generating SQL statement in python _SQL_fields = ("ID", "NAME", "BIRTH", "SEX", "AGE") _add_SQL_desc_type = ("PRIMARY KEY AUTOINCREASEMENT",) _SQL_type = ("INT",'TEXT') _Value = (1,'TOM',19700101,'M',40) bop = ["AND"] * (len(_SQL_fields) - 1) m...

Delete Reccords from a table recursively - SQL Server 2008

Table Structure ID DESC PARENT_ID** 35151 Parent 35154 35152 System 35151 35153 Same as System 35151 35154 ParentsParent 35157 35156 Product 35157 35157 Login Group 35159 Where Id is the primary key, and parent_id is the foreign key referenced in the sa...