sql

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified - works fine in IDE - not once exported.

Hello, I am developing a java app (with odbc bridge - forgive me - the only paradox driver I have been able to obtain is the microsoft odbc driver) - which works fine while in eclipse, (and netbeans) - connecting and obtaining data from an ancient paradox 5.x database. So long as it is run from inside my IDE - it compiles and runs flawl...

A quick over view of facebook's db?

Hey guys I find it hard to believe that Facebook uses simple sql, surely it would use some other method but lets assume for now it does use sql how would the code assimilating the 'wall' work? Lets say that there is three tables (just for the example) Friends: id (entry key) - uid(your id) - fid (your mates' id) Wall:id (entry key) -...

find the all the stored procedures and jobs in sql server 2000

Hi, In SQL SERVER 2005 This query works fine : Select * from sys.procedures where object_definition(object_id) like '%J%' SELECT * FROM MSDB.DBO.SYSJOBS WHERE NAME LIKE '%J%' but in sql server 2000 it is not working. Here i need to find the all the stored procedures and jobs which matches my string ? how to find in sql server 2000 ? ...

Making rows in to colums using sql query

I have a temp table in which have one coloum with four rows. Table ------ vaibhav IBM 12 'T' I need a temp table Col1 Col2 Col3 Col4 ------ ----- ----- ------ Vaibhav IBM 12 'T' Do anyone have any idea. ...

How to query an XML File with E4X in AS3?

I need to archive a database-driven flash as3 website. I exported a table to xml so now i have something like this: <RECORDS> <RECORD> <id>home</id> <msg>bodytext</msg> <type>0</type> <lastEditDate>0000/0/0 00:00:00</lastEditDate> <lastAccessDate>2009/6/17 11:37:21</lastAccessDate> <timesAccessed>855</timesAcce...

MySQL Grouping of data

I want to group my data by Age and by gender: like this sample data: Age: 1 Male: 2 Female: 3 Age 1 Total: 5 Age: 2 Male: 6 Female: 3 Age 2 Total: 9 How can I group the data according to age and count all the male and females in that age from mysql database? ...

sql: delete a subtree table(id, Parentid) , delete a item with all his children

I have a table like this foo(id, parentId) -- there is a FK constraint from parentId to id and I need to delete an item with all his children and children of the children etc. anybody knows how ? ...

Multipart Identifier And Functions

Here is my Query... Here I'm using a function Fn_getStagesForProject()... For which I need to pass the SWProjectID from Projects Table... The function takes the ID as parameter and return all stages that corressponds to the project, on which I need to filer only the row that contains StageLevel as 0. Select A.SWProjectID, ...

Alternative to sql NOT IN?

Hi, I am trying to make a materialized view in Oracle (I am a newbie, btw). For some reason, it doesn't like the presence of sub-query in it. I've been trying to use LEFT OUTER JOIN instead, but it's returning different data set now. Put simply, here's the code I'm trying to modify: SELECT * FROM table1 ros, table2 bal, table3 flx ...

how to view the job in text in sql server 2005

hi, Ex: for store procedure we use sp_helptext .is there any keyword for viewing jobs in text in sql server 2005 regards kumar ...

find relationships in a many-to-many structure with sql

Hi, my question is near a parent-child problem, and may need some recursive query, but i didn't find any answers by browsing forums. here is my problem: I've got 3 tables: T1 (people) T2 (places) T3 (relationship betwenn A and B) ------- ------ -------- id1 (pk) id2 (pk) id3 (pk) name city ...

How do I UPDATE a Linked Server table where "alias" is required, in SQL Server 2000?

In SQL Server 2005 tablename can be used to distinguish which table you're referring to: UPDATE LinkedServer.database.user.tablename SET val=u.val FROM localtable u WHERE tablename.ID=u.ID In SQL Server 2000 this results in Server: Msg 107, Level 16, State 2 The column prefix 'tablename' does not match with a table name or alia...

How can i test my DB speed? (Learning)

I have design a database. Theres no columns with indexing, nor any code for optimizing. I am positive i should index certain columns since i search them a lot. My question is HOW do i test if any part of my database will be slow? ATM I am using sqlite and i will be switching to either MS Sql or MySql based on my host provider. Will crea...

Print out timestamp as number, not human readable

I need a command line that runs against psql and does: psql database -c "select date_trunc('day', start) as date, avg(finish - start) as duration from things group by date order by date;" But the problem is this gives me human readable output, aka: date | duration ---------------------+----------------- 2010-01-11 00:...

MYSQL Select Statment with Modification to tuple values

Hi, I have the following table: bar_id, bar_name, subscription_id_fk, sub_name eg: 1, Hard Rock, 2, Gold 2, TGIF, 1, Free Now I need and SQL to extract this table, but where sub_name = Gold, I need to double the subscription_id_fk. Can you please help ? Edit: I need this value to be only changed in the result of the SQL statment...

How do I generate a unique ID without using AUTOINCREMENT

I am exporting data from csv into mysql database, I want the database to generate a unique id for each imported record. I want to use the unique field in generating a receipt number in crystal report. What would you suggest as the best way of doing this? ...

Sql Server query performance

I have a stored procedure on a busy database which constantly come out top in the list of expensive queries (by some way). The query is very simple, it takes a single parameter (@ID, int) which is the primary key of the table, and selects the record that matches that ID. The primary key is an identity field with a clustered index, so I...

Suggestions on documentation of a DB model when using Entity Framework 4

Any experiences on how to document Entity Framework 4 based Database projects? There is the Document and Summary properties on the Entities, but if we want to regenerate the model from the database at some point, it will be lost! Is there some way to map documentation data inside SQL to the Entities in the EDMX file so it is safe. Sug...

What is the result of this SQL query?

I'm working on a mock exam paper at the moment, however I have no set of correct answers and I'm not sure what the correct answer of this SQL query is. Given a table: foo, bar a , 1 b , 3 a , 2 c , 1 and the query: SELECT foo, sum(bar) FROM table GROUP BY foo The two ways I can see this going are either: a 3 a 3 b 3 c 1 or ...

select more rows as a column

I have a MySQL issue i want to have the result of the next query into a var and use it to update into the trigger i am trying to get the names comma separated The query returns more then one row SELECT t.naam FROM trefwoorden t INNER JOIN organisaties_has_trefwoorden AS o ON (t.id_trefwoorden = o.id_trefwoorden) WHERE o.id_organ...