I have a query
insert into carsdescription
(description,idCar)
value (@description,@idCar)
where idCar=@idCar;
select nameOfCar
from Cars
where idCar=@idCar";
How to in one sqlCommand execute this??
using(SqlConnection conn=new SqlConnection(connString))
{
using(sqlCommand cmd=new SqlCommand())
{
cmd.Parame...
I have an update statement that goes thus:
update tableA
set val1='X', val2='Y'
where id in (
select id from tableA A
LEFT JOIN tableB B ON A.col1=B.col1 and A.col2=B.col2
where A.col3='xx' and B.col3= 'YY')
Now, the inner SELECT statement runs in 10 minutes returning 1000 records (both tableA and tableB have ab...
I want to throw an exception if cardescription is in table in row with specific @idCar
cardescription is not PK, and any change in design is not allowed
insert into carsdescription
(description)
value
(@description,@idCar)
Examples:
IDCar | Description
---------------------
1 | nice - this record was in table ...
Hello,
I've been stuck on this issue for several days - any help is much appreciated.
I have an SQL trigger that's calling a DLL written in C#. In this function, I require the windows login name of the person that originated the SQL command that fired the trigger. It doesn't matter whether I get this info from C# or SQL.
Unfortunately...
I'm getting the same results from
select length(column_name) from table
as
select dbms_lob.getlength(column_name) from table
However, the answers to
this question seem to favor using dbms_log.getlength().
Is there any benefit to using dbms_lob.getlength()?
If it changes the answer, I know all of the blobs are .bmp images (nev...
Hi there,
given the two tables and values:
Tables
People- Columns: [ID]PK Name
Field - Columns: [ID FieldName]PK FieldValue
Values
People
ID Name
1 Mary
2 John
3 Tony
Field
ID FieldName FieldValue
1 Age 20
1 Country USA
2 Age 21
2 Country USA
3 Age 20
3 Country USA
I would like a query th...
I have the following shortened classic ASP code that makes a SQL insert call...
cmd.CommandText = "insert into MyTable values(blah, blah, blah)"
cmd.CommandType = adCmdText
Set rs = cmd.Execute()
Using the recordset that Execute() returns how can I tell whether the insertion was successful or not?
...
What applications are recommended for SQL Server auditing and, more specifically, fraud investigations?
I need a tool that allows an end user to correlate data values to find fraud patterns. This tool must allow tuning as needed to reduce false positives.
It's also important that it be fairly intuitive. Ideally, once in place it wo...
I want to make a webapplication in witch there will be some users with different projects (like c project, c++ project so on). My question is that how should I build up my 3 tables: users,projects,files? One user can have many projects (there will be shared projects too), the projects can have folders(packages) and files, but on the file...
just for knowledge in interview question.
and my knowledge.
SQL - Difference between Cluster and Non-cluster index?
...
SQL syntax question about UPDATE. It would be much easier to ask the question by giving example below:
**Payments Table**
ID user_id payment_due payment_made
1 3 10.0 5.0
1 3 10.0 10.0
1 9 20.0 20.0
**Balance Table**
ID user_id current_balance
1 3 ...
I have a logging table that contains data that looks like this:
ID MSG DATE
---------------------------------------------
1 TEst 2010-01-01 09:00:00
2 Job Start 2010-01-01 09:03:00
3 Do something 2010-01-01 09:03:10
4 Do something else 2010-01-01 09:03:12
5 Do so...
i have one database in ms sql server 2005.
i create this long time back, now want to modify it but i lost the password, i remember the user name for that database, is there any way to recover the password for that database or
change its password ?
Thanks
...
Lets say I have a table with the following columns:
Qty, INTEGER
SaleDate, DATETIME
I would now like to see this result:
Sold in the last 7 days | Sold in last 14 days
-----------------------------------------------------
10 | 20
I can use a where clause to use between, however how would I get the qty sold for...
I'm convinced this will make me slap myself when I see the answer but here goes...
Say I need a list of all products from a certain vendor but they need to order by a specific variable productType at the top and below it doesn't really matter but all products have to be in the list.
So basically
SELECT * FROM Products p WHERE p.Vendor...
In the above FldID 52 = Description and FldID 54 = HistoryDetail
For any given date the output should be the last entry for that date. Also the columns need to be become rows.
User will provide 2 dates. Say March 2, 2010 and March 3, 2010.
So output in above case should be
Since Rev 6 does not have an entry for FldID 52...
I'm using php 5.2 with oracle 11.1.
This code:
$query = oci_parse($conn, "SELECT * FROM COMMENTS WHERE PINID=$pinID and COMMENTID=$commentID");
results in this error:
<b>Warning</b>: oci_execute() [<a href='function.oci-execute'>function.oci-execute</a>]: ORA-00904: "COMMENTS": invalid identifier in <b>C:\IODwww\hello.php...
I want to store a price for an item in decimal in MySQL.
How would I have to format the price in order to store in in the db?
...
I am quite new to the postgresql.
what is the best way to achieve this?
SELECT get_columns()
FROM table_name;
get_columns() will provide the column names for the query. I saw people advising to use EXECUTE statement but I couldn't got that working.
Lets say there is table Test with columns a,b,c
and I want to run
SELECT a,b FR...
I'm writing a script that is supposed to run around a bunch of servers and select a bunch of data out of them, including the local server. The SQL needed to SELECT the data I need is pretty complicated, so I'm writing sort of an ad-hoc view, and using an OPENQUERY statement to get the data, so ultimately I end up looping over a statement...