I need to update a row with a formula based on the largest value of two DATETIME columns. I would normally do this:
GREATEST(date_one, date_two)
However, both columns are allowed to be NULL. I need the greatest date even when the other is NULL (of course, I expect NULL when both are NULL) and GREATEST() returns NULL when one of the co...
I have two query results from different tables like below.
ID F1 F2 F3 ID F3 F4 F5
S1 d11 d12 d13 S2 d23 d24 d25
S2 d21 d22 d23 S3 d33 d34 d35
S3 d31 d32 d33 S4 d43 d44 d45
ID and F# are field names, the others are values.
I want to get a new result in a similar form to the follow...
Hi there
I use MS Access as a front end to my MS SQL server.
When I use a SQL query in ms Access that is (in my opinion) equivalent to a query I run from the SQL server, Access returns different data. The pictures below illustrate the difference. I use Access 2003 and I have connected the Access table to the SQL server (2008) through O...
mysql> select 0.121='0.121';
+---------------+
| 0.121='0.121' |
+---------------+
| 1 |
+---------------+
Does it hold for other database that number='number' is true?
...
Hey Everyone
I am starting off in the .NET world and wanted to know what a great beginner book would be that would explain how to use asp.net, vb and SQL.
I hear "Learning Visual Basic" is a good series but wanted to see if there were anymore out there.
Thanks for your help!
...
Below SQL query works when the spaces in the role name are replaced by %: 1 row is returned
select * from cmrdata.dbo.tblRoles where rolename like '%Super%Administrator%'
However, when I try to mimic the same in DataView.RowFilter, it does not return any rows.
dv.RowFilter = "RoleName like '[%]" & Replace(roleName, " ", "[%]") & "[%]...
I have following data
UserID UserName LogTime LogDate
1 S 9:00 21/5/2010
1 S 10:00 21/5/2010
1 S 11:00 21/5/2010
1 S 12:00 21/5/2010
Need Output as:-
1 s 9:00 10:00 21/5/2010
1 s 11:00 12:00 21/5/2010
...
I need to find a way to do an INSERT INTO table A but one of the values is something that comes from a lookup on table B, allow me to illustrate.
I have the 2 following tables:
Table A:
A1: String
A2: Integer value coming from table B
A3: More Data
Table B:
B1: String
B2: Integer Value
Example row of A: {"Value", 101, MoreData}
E...
hi, i m not able to modify table in SQL server. i m new to databases.
use work
go
alter table employee
modify id varchar(20)
error message is-
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'modify'
here is an screenshot
thanks
...
What is the best way to assemble an SQL query with join conditions dynamically? I don't want to hard code the query for each different condition on a webpage or a set of webpages. Is it even feasible?
I got as far as being able to assemble simple queries but i got stumped when i needed to insert join conditions, i.e. how to figure out d...
I am trying to create some script variables in T-SQL as follows:
/*
Deployment script for MesProduction_Preloaded_KLM_MesSap
*/
GO
SET ANSI_NULLS, ANSI_PADDING, ANSI_WARNINGS, ARITHABORT, CONCAT_NULL_YIELDS_NULL, QUOTED_IDENTIFIER ON;
SET NUMERIC_ROUNDABORT OFF;
GO
:setvar DatabaseName "MesProduction_...
Im having a very strange problem, i have a complicated view that returns incorrect data when i query on a particular column.
heres an example:
select empname
, has_garnishment
from timecard_v2
where empname = 'Testerson, Testy';
this returns the single result 'Testerson, Testy', 'N'
however, if i use the query:
select empna...
I have this:
$query="DELETE FROM classified, $sql_table WHERE classified.ad_id = '$id' AND classified.classified_id = $sql_table.classified_id AND classified.poster_password='$pass'";
I get this error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ...
How do I get the Date 5 Months from Now in access
...
I've been having a problem for the past month and can't seem to figure out what is wrong. Here's the setup and a little background.
Background:
I have a web-host who was running my website on Windows Server 2003 and SQL Server 2000. One of my webpages returned a result set from a stored procedure from the SQL server as xml. Below is th...
Describe the output of the following SQL query:
select custId, name
from customer
where region = "New York"
UNION
select cust.custId, cust.name
from customer cust
where cust.custId IN (select cust_order.custId
from customer_order cust_order, company_employee comp_emp
where cust_order.salesEmpId = comp_emp.empId
AND comp_emp.name = 'DAN...
There is one table T ( id integer, primary key ( id).
I want a parameterized query that, given id i:
will return next consecutive id,
if i = biggest id in T, query should return the smallest id in T (cyclical)
...
table1 (id, name)
table2 (id, name)
Query:
SELECT name
FROM table2
-- that are not in table1 already
...
I need to be able to check if a variable has a certain string of text inside it. Here's what I have now:
--This sample always goes to the ELSE block.
IF( @name LIKE '%John%' )
BEGIN
--do one thing
END
ELSE
BEGIN
--do the other thing
END
...
I'm working with a C# and Linq to SQL Winforms app and needed to integrate backup and restores through the program. I used SMO and got it working pretty smoothly. The issue, however, is that the app is deployed using ClickOnce, which I like very much - but since I had to include the dll's the download size jumped from 3mb => 15mb. I know...