I'm don't have much experience in writing SQL so maybe this is a fairly trivial question but right now I have a SQL query where need to do a 'like' on multiple fields, at present I do:
select *
from tableX
where col1 like '10%'
or col2 like '10%'
or col3 like '10%'
or col4 like '10%'
or col5 like '10%'
or col6 ...
Hi all, I just stumbled upon something in ORACLE SQL (not sure if it's in others), that I am curious about. I am asking here as a wiki, since it's hard to try to search symbols in google...
I just found that when checking a value against a set of values you can do
WHERE x = ANY (a, b, c)
As opposed to the usual
WHERE x IN (a, b, ...
I have borrowed a query and adapted it for my own purposes, but I don't like doing this when I am not entirely sure what it is doing. SQL docs are less than descriptive on this clause. Here is what I borrowed and modified, can you tell me what it is doing basically?
(SELECT Id FROM
(
SELECT
Id
,RAN...
How do I add an attribute to xml contained within a CLOB in an Oracle database? I can use the UpdateXML function to update an existing attribute but it will not add one.
...
As you can probably very soon see, I am a complete newbie at VB.NET, and I am having some trouble getting output from a stored procedure in SQL Server 2005.
This is the code I use
Dim con As New SqlConnection
Dim cmd As New SqlCommand("esp_getDates", con)
Dim par As New SqlParameter("@PlaceID", SqlDbType.Int, 3906)
con....
Hello,
I want to run 200+ select queries and append the results to a file. All queries are the same the only difference in the date-time variable. I don't have privileges to create a routine that's why I had to create all the queries. I don't have privileges to create a view or another table to store the results in. I don't have access...
I was just reading a question about how to add parameters to a SqlCommand in .NET, and it raised a question for me. In all of my programs, this is how I add parameters to my commands:
SqlCommand cmd = new SqlCommand(cmdText,conn);
cmd.Parameters.Add(new SqlParameter("@name",value));
I know that you can also add parameters in the foll...
Hello,
I am currently planning a new system in PHP/MySQL and want to make sure my database can handle the amount of data that I am planning to store. One of the features of my new project is a "messages" feature like Facebook. I want to make sure I create the best possible experience for the end user. The website will eventually handle 1...
I need blog software for IIS7 and a SQL Server 2008 backend. I don't know if this is required, but the application (website) I'm hosting is in asp.net (vb.net). Does anyone have any ideas?
I checked out das blog, and graffiticms and they're very old. Thanks in advance.
...
When I'm using sqsh in interactive mode, sometimes I like to run my query in the following way so I can get it in a nice csv file:
1> select * from Table where
Blah=Blah
2> go -m bcp >
/file/name/here
The only problem I have is that using the "-m bcp" option does not give me the column names in the output. Any idea how to ...
I am trying to COUNT two columns in a single query, but the results are spitting out the same values for medcount and uploadcount. Any suggestions?
$sqllog="SELECT * , COUNT($tbl_list.listname) AS listcount,
COUNT($tbl_uploads.id) AS uploadcount
FROM $tbl_members
LEFT JOIN $tbl_list ON $tbl_member...
Is there a way we can specify values in for a case statement? The below statement doesn't execute because it thinks 53,57,82,83 etc are columns.. Is there a work around.. i googled up but found nothing that say you can't use IN case-when expression..
select
x =
case
when xvalue in ([52],[57],[82],[83])
then "xvalue"
w...
I want to drop all tables that does not have rows.
How to drop all empty tables in SQLite?
EDIT
I need to do this on a mobile phone (no shell there). On a Windows Mobile phone.
...
switch($_GET["action"])
{
case "add_item":
{
AddItem($_GET["ids"], $_GET["qty"]);
ShowCart();
break;
}
case "update_item":
{
UpdateItem($_GET["ids"], $_GET["qty"]);
ShowCart();
break;
}
case "remove_item":
{
RemoveItem($_GET["ids"], $_GET["id"]);
ShowCart();
break;
}
default:
{
ShowCart();
}
}
function AddItem($itemId, $qty){
$result...
I have two tables, records and data. records has multiple fields (firstname, lastname, etc.). Each of these fields is a foreign key for the data table where the actual value is stored. I need to search on multiple record fields.
Below is an example query using INTERSECT, but I need one that works in MySQL.
SELECT records.id FROM reco...
What should be the data type in SQL Server to store multibyte characters ? NVARCHAR or VARCHAR
...
Visual Studio 2008 | Silverlight 3 | SQL Server 2005 | Domain Services Class | Entity Data Model
I have a database table "Students" with columns FirstName, LastName, Semester, ProgramOfStudy, Column etc.......
The goal is to return a Total (number of students grouped by first letter of lastname), based on the first letter of the lastna...
In developing a shopping cart application I've found that I needed to save settings and configurations based on the administrator's preferences and requirements. This information can be anything from company information, Shipping account IDs, paypal API keys, notification preferences, etc.
It seems highly inappropriate to create a table...
Visual Studio 2008 | Silverlight 3 | SQL Server 2005 | Domain Services Class | Entity Data Model
I have a database table "Students" with columns FirstName, LastName, Semester, ProgramOfStudy, Column etc.......
The goal is to return a Total (number of students grouped by first letter of lastname), based on the first letter of the lastna...
Say a table has several subclass types. How can I see all columns from different types in sqldeveloper? In table view, only can see common columns. Thanks.
...