Hello,
I have an application on a SQL Server 2008 database. This database has a stored procedure that queries one of the tables. This stored procedure takes two parameters: userName and ID
The userName parameter will always be passed. However, the ID field will either be NULL or an actual value. If the value is something other than NUL...
I am having issues executing a SQL statement from a stored proc having single quotes. Here is my query from a stored procedure that I am executing.
EXEC('UPDATE myTABLE
SET myCOLUMN = (SELECT Replace('OSINGLEQUOTEJOHN DOE','SINGLEQUOTE','''')')
I am trying to update table "myTABLE" column "myCOLUMN" with a value "O'John Doe"...
Possible Duplicate:
Is there a performance difference between BETWEEN and IN with MySQL or in SQL in general?
If I have the following ids:
1,2,3,4,5,6
Is it better to use IN or the between clause for deleting?
...
I am using SQL Manager Lite to try to run a DDL Create Table script. I am new to Firebird and I don't know why it isn't working. The following script...
create table Contacts (
ID integer not null,
FirstName varchar(64) not null,
LastName varchar(64) ...
Hi, is it possible to convert a SQL Server database file to a MySQL Database file and if so what would be the best way to go about doing this. Thanks.
...
I see some people do joins like this
SELECT * FROM table1
JOIN table 2
ON table1_id = table2_id
where as some people do this
SELECT *
FROM table1
WHERE table1.table1_id = tabl2.table2_id;
whats the difference and what is more efficient and benificial
...
The sql query is
$query = mysql_query( "SELECT * FROM games ORDER BY gamename" );
But it doesn't order them by the gamename. This is a sample of the database
id (int) | gamename (text) | gameurl (varchar) | width (int) | height (int)
1--------- Copter ---------- copter ----------- 100 ---------- 200--------
2--------- Adrenaline -...
Currently, I only use stored procedures, is this considered good practice or bad? I find it helpful to separate my SQL code from my PHP code, and I also remember hearing in a PHP course I took a few semesters back that stored procedures are more secure.
...
Hi gurus,
I am planning an application that involves pulling XML data from the server side and manipulating it on the client side before allowing the user to save it as CSV.
On the server side, I will use Apache and PHP as the primary service interface, and the data source could be coming from MySQL server and/or Exist database server....
I have a script that processes queued records in a SQL table in SQL Server 2000. I now need to add additional instances of my script to process their own subset of the queued records in the table.
How can I query the table within each instance so that each instance will return a subset of rows that never overlap with each other?
I cou...
Im a little confused about whether should I use a nested Subquery Or JOINS with distinct !!
which one of these will perform better and faster ?
any suggestions to do this query without distinct ?!?
SELECT distinct TOP(20) e.*, u1.UserName As Sender,
u2.UserName As Receiver, u1.Avatar AS SenderPic
FROM Friends f INNER JOIN Users u
ON...
there is a datagridview corresponding to a table of some database.
this database has a identity (auto-incrementing) column named "id".this column is primary key,also.
user just see a blanked and empty datgridview.he/she can modify this table(datagridview)
for example add new row,remove it,edit(update)one cell and can do every possible mo...
Hello,
The title could be confusing, but I think my doubt is clear.
I'll explain. I'm doing this query:
$sql = 'SELECT * FROM calendar WHERE day = "'.$day.'" AND month = "'.$month.'" AND year = "'.$year.'" AND realizada = 0 AND colaborador = "What to put here?!"';
But the field "colaborador" is a serialized array.
One example, whe...
Hello
I have two tables with a variable amount of columns. (I don't know how many columns or what there names will be) for example Table A and Table B.
TableA:
ID | B_ID | {variable}
TableB
ID | {variable}
Query:
SELECT TableA.*, TableB.* FROM TableA INNER JOIN TableB ON TableA.B_ID= TableB.id;
When TableA and TableB bot...
I have a table of data. I have a field which shows date. I had set this column as Start Date. I want to create an additional column as End Date, where the End Date will be the Start Date of the next row. Can you give me a query of creating the End Date by taking the data of the Start Date in next row ?
...
I'm writing stored procs that are being called by a legacy system. One of the constraints of the legacy system is that there must be at least one row in the single result set returned from the stored proc. The standard is to return a zero in the first column (yes, I know!).
The obvious way to achieve this is create a temp table, put the...
I am attempting to use a case statement but keep getting errors. Here's the statement:
select TABLE1.acct,
CASE
WHEN TABLE1.acct_id in (select acct_id
from TABLE2
group by acct_id
having count(*) = 1 ) THEN
...
I am using Access 2007 to create an SQL query to join two tables. I was able to do that but then I don't have the rows where the columns from the second table are NULL; I just have the rows where there is information in the second table that matches. I tried to do a LEFT JOIN but Access didn't like this. Instead I am trying to create a b...
Let's say you have a notes table. The note can be about a particular account, orderline or order.
Notes that are about the account do not apply to any specific orderline or order.
Notes that are about the orderline also apply to the parent order and the account that is attached to the order.
Notes that are on the order also apply to t...
Hi,
I'd like to execute something like this on my MySQL server:
SET @id=(SELECT id FROM lookupTable WHERE field=?);
(SELECT * FROM table2 WHERE id=@id)
UNION
(SELECT * FROM table3 WHERE id=@id)
UNION
(SELECT * FROM table4 WHERE id=@id);
This works fine from the console, but not from my Java PreparedStatement. It throws an exception...