Is it possible to use case statement within an update query? I need to do something like this: If person name starts with 'S' then append '1', else append '2'.
I tried this in sql server and it didn't work
UPDATE PERSON
CASE
WHEN NAME LIKE 'S%' THEN SET NAME = NAME + '1'
ELSE SET NAME = NAME + '2'
END
...
Hello, I have a treeList, loaded with data from SQL DB. The logigs in sql for tree is standart: ID, ParentID and other fields.
Now i want to implement Copy-Paste in this tree. When I click on tree, and select "Copy" button on some node with some tree structure, i select to DataTable all information about that object and all his children,...
I have some doubt regarding user defined functions. I would like to know why / when to use functions.
What are the advantages of functions over stored procedure?
Researching via google I have seen articles suggesting:
stored procedure are more advantageous than functions.
function have limited error handling
functions cannot use tem...
Is this possible:
mysql_query("SHOW VARIABLES LIKE 'query%'");
in php?
If so how can I display the variables onto the browser?
If it is not possible, which mysql command tool is easiest and free to download?
Thanks
...
I have 2 tables. The first one is "product" with "id" and "title" columns. The second is "price" with "productId", "price" and "weight" columns. One product can have several weights with it's own price (Simplified situation.)
I want to select all products sorted (DESC) by their minimal price. How to do this?
...
Is it possible to get the size of the result-set when doing a query?
I need to set a proper MySql cache_limit (MB) and therefore I am trying out some queries, but I need to know the sizes of the result-sets to fine-tune my cache configurations.
What exactly does query_cache_limit do when measuring the size of a query (or result)...
An...
I've been looking into the use of the Unicode 'N' constant within my code, for example:
select object_id(N'VW_TABLE_UPDATE_DATA', N'V');
insert into SOME_TABLE (Field1, Field2) values (N'A', N'B');
After doing some reading around when to use it, and I'm still not entirely clear as to the circumstances under which it should and should...
Hi,
So I'm having a head against the wall moment and hoping somebody can come help either remove the wall or stop my head from moving!!
Over the last 3/4 weeks I've been investigating ORM's in readyness for a new project. The ORM must map to an existing, large and ageing SQL database.
So I tried Subsonic. I really liked v2 and v3 aft...
This should be easy
I have a date column on table A
SELECT * FROM TABLEA
WHERE DTE = '01/02/2010'
The problem is that this is deployed onto US servers and I have no control over the date as its an arg.
How can I tell SqlServer to treat this date as being in that format??
I gave tried this:
SELECT *
FROM TABLEA
WHERE DTE = CONV...
Is there any in built functions in SQL server to find whether the given value is integer or currency or date or decimal?
...
Hi,
I am just unsure what use of ".." means. I cannot google it due to characters itself. I think it can be written also that way?: INSERT INTO X.dbo.Y. Or what is it?
Thank you
...
how can i get row count values in mysql as @@ROWCOUNT in mssql
...
I need to figure out the best way, in SQL, to query on a Parent / Child relationship. Some of the parent fields will be the data for the child. Here is an example:
ID Field1 Field2 ParentId
--------------------------------------------
1 stuff moreStuff 0
2 childStuff (from parent) 1
So, Field...
We have a 300 Gb+ data array we'd like to query as fast as possible. Traditional SQL databases (specifically, SQL Server) cannot handle this volume as effectively as we need (like, perform a select with 10-20 conditions in where clause in less than 10 sec), so I'm investigating other solutions for this problem.
I've been reading about N...
I want to return custom values as the values of the rows in case when no rows are fetched by executing the stored procedure
How do i do that?
...
This might be a basic question, but I tried googling it and couldn't find an answer.
I need to make a list of all the SQL Servers on a network. This is very easy to do using the .NET framework (System.Data.Sql.SqlDataSourceEnumerator), but is there also a relatively simple way to do this in java as well? While I was doing my research, I...
How can a domain object include a property that calculates a value from other database mapped properties so that the calculated property can be used in both the domain object instance and the db level by nhibernate.linq.
I would like to be able to use the property when working with the object directly:
Console.WriteLine(Entity.Calculat...
Just looking for opinions on the following 2 scenarios.
We have a table where we store our outbound sms-messages. Everytime one of our services sends a premium rate message, it stores them in this table... to date, all the important information that needs to be stored has been in the same format.
SMSMessages
----------------------
ID ...
I'm using Open Flash Chart to create statistics and one of the things i need to be able to do is generate a Stacked Bar Chart.
Logically i need to be able to Group all the distinct Month/Year combinations, Dec 2009, Jan 2010, Feb 2010 etc. and then from that group all the various rows, i.e. the different types of enquiry a visitor made ...
Hi Everyone.
I have a query in which I need to perform using three entities listed below:
LU_AppName
SDB_AppHistory
SDB_Session
LU_AppName has field APPNAM, SDB_AppHistory has the field STARTTIME which is date/time and also SDB_Session has field DURATION.
I need to run an SQL query to show me Citrix APPLICATIONS which have not been...