sql

SQL inner join from field defined table?

I have a, currently, a total of 6 tables that are part of this question. The primary table, tableA, contains columns that all the entries in the other 5 tables have in common. The other 5 tables have columns which define the entry in tableA in more detail. For example: TableA ID|Name|Volume|Weight|Description --+----+------+------+--...

How would I do this in SQL?

Let's say I have the following tables: PartyRelationship EffectiveDatedAttributes PartyRelationship contains a varchar column called class. EffectiveDatedAttributes contains a foreign key to PartyRelationship called ProductAuthorization. If I run this: select unique eda.productauthorization from effectivedatedat...

SQL Joins Excluding Data

Say I have three tables: Fruit (Table 1) ------ Apple Orange Pear Banana Produce Store A (Table 2 - 2 columns: Fruit for sale => Price) ------------------------- Apple => 1.00 Orange => 1.50 Pear => 2.00 Produce Store B (Table 3 - 2 columns: Fruit for sale => Price) ------------------------ Apple => 1.10 Pear => 2.50 Banana => 1.00 ...

SQL Server table is sorted by default

I have simple SSIS package where I import data from flat file into SQL Server table (SQL Server 005). File contains 70k rows and table has no primary key. Importing is sucessful but when I open SQL Server table the order of rows is different from the that of file. After observing closely I see that data in table is sorted by default by f...

Optimizing a Soundex Query for finding similar names

My application will offer a list of suggestions for English names that "sound like" a given typed name. The query will need to be optimized and return results as quick as possible. Which option would be most optimal for returning results quickly. (Or your own suggestion if you have one) A. Generate the Soundex Hash and store it in the...

code comparison between ORM (doctrine) and SQL?

i've read a lot about ORM but wondering if there are side by side comparison examples between an ORM like doctrine and SQL so that you could see what is more easier to maintain? couldn't find such comparisons in google. ...

How to renumber primary index.

I have got a simple MySQL table and primary index (id) is not numbered one by one (1, 31, 35, 100 etc.). I want them to be numbered like (1, 2, 3, 4). Please tell me how to do it. I would also like to point that I am aware of possible consequences of the operation, but I just want to tidy up the table. ...

servlets and resource file

Is it possible to write database methods in properties file, like some database queries and can be accessed using servlets which may reduce the code? ...

SQL Queries for Creating a rollback point and to rollback to that specific point

Hi, As per my project requirement i want to perform two operation Password Change Unlock Account(Only unlocking account, no password change!) I want return success only if both the transactions succeeds. Say if password change succeeds and unlock fails i cannot send success or failure. So i want to create a rollback point before pas...

How to combine specific column values in an SQL statement

There are two variables in our database called OB and B2B_OB. There are EP codes and each EP may have one of the following 4 combinations: EP OB B2B_OB --- -- ------ 3 X 7 X 11 14 X X What I want to do is to combine the X's in the fetched list so that I can have A or B value for a single EP. My conditions are: IF...

How to transform vertical table into horizontal table?

Hello, I have one table Person: Id Name 1 Person1 2 Person2 3 Person3 And I have its child table Profile: Id PersonId FieldName Value 1 1 Firstname Alex 2 1 Lastname Balmer 3 1 Email [email protected] 4 1 Phone +1 2 30004000 And I want to get data from these two tables in one row ...

MS SQL server and Trees

Im looking for some way of extrating data form a tree table as defined below. Table Tree Defined as :- TreeID uniqueidentifier TreeParent uniqueidentifier TreeCode varchar(50) TreeDesc varchar(100) Data some (23k rows), Parent Refs back into ID in table The following SQL renders the whole tree (takes arround 2 mins 30) I need to do...

What are maintenance steps and performance steps for Mysql server/database ?

Like index maintenance we have index reorganize/rebuild, update stats, shrink database log files , database backup/restore in MS SQL server, What are maintenance steps and performance steps for Mysql server/database ? ...

How many maximum recursion possible for CTE in SQL server?

How many maximum recursion level possible for CTE in SQL server? If maximum recursion level is reached then what are the alternative way? ...

How to read data from SQL database and store it into an XML file ?

I have a Silverlight application that reads its content from an XML file. User can enter data and It'll be stored in SQL database. How can I read the data from SQL database and store it into an XML file ? Thanks, ...

Finding date between start date and end date

Hi, I want to check whether a date is between start date and end date. i have added a where clause where datepaid between '2010-04-01' AND '2010-04-15' but the problem is that it excludes '2010-04-15'. It should include end date also how can i do this? Please help me on this Regards, pankaj ...

how to upload .txt files to sql database using asp.net(C#)

how to upload .txt files to sql database using asp.net(C#) ...

Can I use SQL Server Compact Edition CE on Mono?

Does anyone know if I can use SQL Server Compact Edition 3.5 on mono? I'm hoping they are written as managed assemblies and will work ok..does anyone have any experience? ...

Getting max. screen resolution with Group By

Question: I have a website where I gather browser statistics. Thus, I have an SQL table (T_Visits), with the following columns: uniqueidentifier Visit_UID, uniqueidentifier User_UID, datetime Visit_DateTime, float Screen_w, float Screen_h, float Resolution = Screen_w * Screen_h varchar resolutionstring = screen_w + ' x ' + screen_...

Asterisk with new functions

hi all , please need help for an asterisk with windows I created a write func odbc list records files in sql table: [R] dsn=connector write=INSERT INTO ast_records (filename,caller,callee,dtime) VALUES ('${ARG1}','${ARG2}','${ARG3}','${ARG4}') prefix=M and set it in dialplan : exten => _0X.,n,Set( M_R(${MIXMONITOR_FILENAME}\,${CU...