sql

Can SQL Server Management Studio 2005 work with SQL Server Express 2008?

I'm getting crazy trying to install SQL Server Express Management Studio 2008 http://stackoverflow.com/questions/1583545/pb-for-installing-sql-server-express-management-studio-2008/1583669#1583669 I have tried 10 times, now I give up. But maybe I can try to work with SQL Server Management Studio 2005? Do you know if it will work? ...

MySQL full text search for words with three or less letters

I'm trying to get my full text search (in boolean mode) to retrieve words with three letters or less. Currently, if I search for something like "NBA", I don't get any results. However, if I append the wild card operator "*" to the search term, I get results. I also read that you could remove the three word limit in my.ini, but I'm won...

Create a mysql primary key without a clustered index?

I'm a SQL Server guy experimenting with MySQL for a large upcoming project (due to licensing) and I'm not finding much information in the way of creating a primary key without a clustered index. All the documentation I've read says on 5.1 says that a primary key is automatically given a clustered index. Since I'm using a binary(16) for t...

Is it better in MySQL to have 1 large table or 2 smaller tables?

Here is my situation: I have about 50 different fields of data that I need to store for 1 record (none are the same or repeating). About 15 of the fields are ones that I commonly need to use in queries, while the remainder are used on occasion (~40% of the queries). Should I setup 2 tables, one containing the common fields and the other...

mysql query with select - where - in - join

Which is the better way of retrieving multiple rows? select * from order_details where order_id in (1,2,3, ... .... ) ...or: select * from order_details INNER JOIN orders on orders.id = order_details.order_id INNER JOIN customers on customers.id = orders.customer_id where customers.id = 3 ...

MySQL Select Statement, WHERE 'IN' Clause

Hello, I currently have the following row in my table: course_data: user_id days <-- This is a varchar column. 405 1,3,5 and I am trying to implement the following SELECT statement: SELECT usrID, usrFirst, usrLast, usrEmail FROM tblUsers WHERE usrID NOT IN ( ...

How would I retrieve parent categories in a mysql query?

My goal is to achieve a list of parent categories from a nested category the easiest way. Say if I had a site that sold a variety of different products, one of which is a quad core pentium. A feature that I'd be able to display on my webpage is as follows: Electronics > Computers > CPU's > Intel > Intel Quad Core The category table tha...

How to delete multiple rows in SQL Server

I have a secondhand sale car database and four tables with relationships. Same column names have relationships. Tables are: Record: RecID Markname Model... Features: FeatureID Featurename Marks: MarkID Markname Carfeature: CarfeatureID RecID FeatureID Now, i want to delete a mark from Marks in c#. When i delete a mark, SQL must delete ...

SQL query doesn't work when using UNION?

Here is the snapshot of the query that doesn't work since I added the Union. SELECT fin05_usager.idUsager, (SELECT sum(nombreReputation) as nombreReputation FROM (SELECT SUM(nombreReputationGagner) as nombreReputation FROM fin05_usager_reputation WHERE fin05_usager_reputation.idUsager =...

php timestamp time function. 2008 is larger number then 2009

I don't get it I want to calculate something I want to check if the time out of the database is before or after this time so I made this. $qVraagCodeOp = "SELECT * FROM `code` WHERE `Code_Code` = '$value'"; $rVraagCodeOp = mysql_query($qVraagCodeOp); $aVraagCodeOp = mysql_fetch_assoc($rVraagCodeOp); $oldTime = mktime($aVraag...

Oracle string_agg(distinct columnname) does not work in pl/sql, only in sqldeveloper

I am trying to get the string_agg function, detailed here to work with the distinct keyword. Sample usage: select string_agg(distinct a.name), a.id from tbl_a a group by a.id The problem is that this works in sqldeveloper, but when running it in application express in an anonymous pl/sql block, it refuses to accept the distinct keywo...

How do I escape a single quote in sqlserver?

I'm trying to insert some text data into a table in SQLServer 9. The text includes a single quote. How do I escape that? I tried using two single quotes, but it threw me some errors. eg. insert into my_table values('hi, my name''s tim.'); ...

MySQL Query Browser - using variables

I'm used to MSSQL's Query Analyzer. Needing to convert some SP's for a hobby project, I'm having trouble making the transition to the mysql query browser, particularly when it comes to using variables. I'm essentially trying to simulate a procedure before it's a procedure. So in Query Analyzer i'd write something like this... delca...

How to select data using multiple times in the 'where' clause

Hi guys, I have two columns of data in a SQL 2005 DB Datetime Value '2009-10-29 10:00:00' ' 10.1' '2009-10-29 10:15:00' ' 10.2' '2009-10-29 10:30:00' ' 10.3' '2009-10-29 10:45:00' ' 10.4' I want to SELECT Value FROM [table] WHERE Datetime >= '2009-10-29 10:00:00' AND (Datetime NOT BETWEEN '2009-10-29 10:14:00' AND '20...

Compare Disparate Data

We currently have a process where we receive an inventory file from a vendor every hour. We need to compare that inventory data in the file to what we currently have in our DB. Any thoughts/ideas on how you would approach this? Here is what we are doing currently: We pull the data from the db table into C# and do the same with the fi...

Easiest way to copy a MySQL database?

Does anyone know of an easy way to copy a database from one computer to a file, and then import it on another computer? ...

SQL DataReader in IronPython

Please help me to read just one record from MS SQL table. I tried to do that in the next way (IronPython 2.6 RC1): cmd = SqlCommand("SELECT * FROM myTable", cn) dr = cmd.ExecuteReader() After that I have ALL the table in dr! But need only ONE record (more precise: read table records one by one) ... Sorry! I was wrong! I forget abou...

How do I limit the amount of results returned in Sybase?

I need to query a Sybase database which has a lot of data in it, and would like to set a limit so the DB stops the query after 10 results. The key thing is performance, so it would be no use if it searched all results and then then returned the last 10 results. Thanks in advance ...

delete records from 2 tables

I have to write a query to delete form 2 tables DELETE FROM [Policies],[BackupSpec] WHERE [PolicyID] = @original_PolicyID PloicyID is PK in Policies and FK in Backupspec any suggestions?? SqlConnection conn = new SqlConnection(); conn.ConnectionString = ConfigurationManager.ConnectionStrings["SumooHAgentDBConnectionString...

mysql - update foreign key with a value

I have a birthdate, year, month, day columns where columns "year,month,day" are foreign key to other tables What I want to do is for each birthdate get id(year(birthdate)) to be the value of year column and the same thing for month and day columns. How can I do this in MySQL? i tried this solution: update member set year=(select All_y...