sql

VB.Net SQLExpress 2008 deployment

I have been developing an application for the last 12 months using VS2008, VB.NET(WPF) and SQLExpress2008. It has been running successfully in a single organization but I now need to consider deploying it to other organisations where I won't know the connection string for the DB, app locations, server locations etc. What is the current ...

How can I migrate my data from Microsoft CRM 3.0 to 4.0.2?

hello guys i am new to data migration. My primary goal is to move the data from Microsoft CRM 3.0 to CRM 4.0.2. We are using SQL Server 2008 as our production server. Can anyone advise me on this? ...

MySQL FULLTEXT indexes problem…

So I’m trying to create a FULLTEXT index on an attribute of a table. Mysql returns ERROR 1214: The used table type doesn’t support FULLTEXT indexes. Any idea what I’m doing wrong? ...

Should I use composite primary keys or not?

There seems to only be 2nd class support for composite database keys in Java's JPA (via EmbeddedId or IdClass annotations). And when I read up on composite keys, regardless of language, people keep coming across as them being a bad thing. But I cannot understand why. Are composite keys still acceptable to use these days? If not, why not?...

How do I automate a report on variance in the same SQL table fields on monthly basis?

I have a T-SQL view with integer fields. I need a report on a monthly basis regarding the difference from one month to the next, i.e. so many people were engaged in a particular activity on 8am of the 1st of this month, so many the previous month, here is the difference. The numbers fluctuate all the time. I need a variance between 2 sna...

SQL QUERY FOR COUNT

HOW TO DISPLAY FIRST AND LAST ROW VALUE FROM THE TABLE BY USING COUNT EXAMPLE: ID TIME DATE 001 10.00 02:10:2009 001 02.00 02:10:2009 001 23.00 02:10:2009 002 04.00 03:10:2009 002 12.00 03:10:2009 002 22.00 03:10:2009 SELECT ID, COUNT(*) AS TIME FROM TABLE OUTPUT IS ID date TIME 001 02:10:2009 ...

SQL QUERY FOR TIME

Possible Duplicate: SQL Query Help Duplicate of http://stackoverflow.com/questions/939055/sql-query-help Two Tables T_Person – Table 1 CARDNO 168 471 488 247 519 518 331 240 518 386 441 331 T_Cardevent – Table 2 CARDEVENTDATE CARDEVENTTIME 20090225 163932 20090225 164630 20090225 165027 20090225 165137 20090225 165147 2...

How to retrieve 10 latest DISTINCT IP's from a MySQL table?

Hey guys, I have a table containing pagehit (normalized) data and I need to grab the 10 latest unique ips. I tried to do it like this: SELECT * FROM spy_hits ORDER BY date desc GROUP BY ip LIMIT 10; Which should give me this result: +-----+------------+-----+---------+----+------+------+---------+-------+-------+ | id | date ...

Join two column with the same number of row

Hi all, I want to combine 2 tables into one. Let say I have: Table1 ID Name 1 A 2 B 3 C Table2 ID Name 4 D 5 E 6 F I want to make Table3 Name1 Name2 A D B E C F How can I do this in SQL Server? Any help is greatly appreciated. ...

Problem writing this query in mysql (marking read messages in a forum)

Hey. i am writing a forum, and i have this table that marks messages a specific user read: `read_messages`(`message_id`,`user_id`) a simplified version of the messages table: `messages`(`id`,`forum_id`,`author_id`) now, i want to be able, when retrieving the message data from the database for a given forum, to add a variable that w...

Efficient query to get all child nodes of a tree (mysql)

I'm looking for an efficient query to return the child nodes of a tree . The data structure is: `ct_cid` int(10) unsigned NOT NULL default '0', // the data `ct_level` int(10) unsigned NOT NULL default '0', // the level (0 = topmost) `ct_parent` int(10) unsigned NOT NULL default '0', // parent ct_cid I need to make sure there won...

Flattening intersecting timespans

I have lots of data with start and stop times for a given ID and I need to flatten all intersecting and adjacent timespans into one combined timespan. The sample data posted below is all for the same ID so I didn't list it. To make things a bit clearer, take a look at the sample data for 03.06.2009: The following timespans are overlap...

2 SQL queries in one line - how?

The following errors,so must be wrong,but what is the correct way to do this: $query = "SELECT * FROM tblProducts WHERE ProductId ='$SCId' AND SELECT * FROM tblProducts WHERE Cat ='$CatType' AND Type ='$TypeType'"; $rsPrimary = mysql_query($query) or die ("Query '$query' failed with error message: \"" . mysql_error () . '"'); $num...

Union query throwing 'Invalid use of null' exception

I have two queries in Access. Both of them are moderately nasty to create, but at the end of the process they do have the same number of fields with the same data types. They both work independently, producing the expected results. Unfortunately, SELECT * FROM [qry vaBaseQuery-S2] UNION ALL SELECT * FROM [qry BaseQuery]; throws two ...

Why do I need a connection to create PreparedStatements ?

I would like to use prepared statements, for many reasons. But, I would like to create a method that looks like this: /* This opens a connection, executes the query, and closes the connection */ public static void executeNonQuery(String queryString); In other words, I want my application logic to only have to formulate the queries and...

SQL Regex function that is similar to the MySql REGEX Function

I am looking for a function that would be able to do the same thing as the MySQL REGEX function for TSQL. Basically i need my Query to look something like the following: SELECT * FROM Routing WHERE (@Message REGEX RouteRegex); I am not to keen to use CLR at this point in time. Any Ideas? ...

How do I take the results of multiple selects and combine into one row

hello, I have a table that contains information for 4 electrical generators I would like to have the results of the four querys in one row. does any one have a suggestion. Thanks SELECT avg(KW) as GEN_101_AVG FROM genset WHERE (GenSetName like 'GEA3519') and GenDate >= '1 jan 2003 00:00:00' and GenDate < '1 feb 2003 ...

Keeping tables synchronized in Oracle

Hi, We're about to run side-by-side testing to compare a legacy system with a new shiny version. We have an Oracle database table, A, that stores data for the legacy system, and an equivalent table, B, that stores data for the new system, so for the duration of the test, the database is denormalized. (Also, the legacy system and table A...

Getting the SQL from a Rails Migration

Hi there, Does anyone know of a way to see the SQL that would be generated by a migration (preferably without actually running the migration)? Thanks! ...

Simple Edit/Update actions using LINQ. Isn't my code a bit wrong?

Consider a simple Edit/Update code: public ActionResult Edit(int id) { return View(db.Foos.Single(x => x.Id == id)); } public ActionResult Update(Foo changed) { Foo foo = db.Foos.Single(x => x.Id == changed.Id); foo.P1 = changed.P1; db.SubmitChanges(); } What I am actually trying to do here is to send: UPDATE [dbo].[...