Viewing 15 posts - 1,966 through 1,980 (of 6,036 total)
SQL_Enthusiast (5/7/2013)
I need to know how to select everything LEFT of the ~...
May 7, 2013 at 4:03 pm
Abu Dina (5/7/2013)
Could someone help me generate the following grouping please? Sample data plus expected output below:
Input Table: SiteMatches
Expected Output: SiteMatches_Output

CREATE TABLE dbo.SiteMatches (RetainedRID BIGINT, DroppedRidd BIGINT, Country VARCHAR(100))
INSERT...
May 7, 2013 at 3:48 pm
Try to run queries like this:
select * from FK_Table F
WHERE NOT EXISTS (
select * from PK_Table P
where P.PK_Column1 = F.FK_Column1 and P.PK_Column2 = F.FK_Column2
It should give you the entries (so...
May 6, 2013 at 9:23 pm
Jeff Moden (5/6/2013)
select sum(CONVERT(float, ft.amount))
I could be wrong but if the precision goes past 15 digits, won't you get the same kind of rounding "errors"...
May 6, 2013 at 2:16 pm
kapil_kk (5/6/2013)
Instead of RETURN I have added a SELECT @pSTN statement for the different different conditions and its working 🙂Is it correct?
Yes, it is correct.
In fact, "RETURN @pSTN " was...
May 6, 2013 at 6:25 am
Hi niladri.primalink,
Using correlated subqueries (especially so many of them) is as bad as having an open bottle of rum on the front seat of your car or carrying a gun...
May 6, 2013 at 12:05 am
sqlfriends (5/5/2013)
the goal is to get the first record returned by those columns ordered.
Do you actually mean "the last record"?
If you're after the current address, than it must be the...
May 5, 2013 at 10:52 pm
sqlfriends (5/5/2013)
but how can I get the first record of addressID? I got duplicates.
Can you define "first record"?
And what do those duplicates mean - same pupil lives in multiple addresses...
May 5, 2013 at 9:54 pm
sqlfriends (5/5/2013)
can anyone help make this query more efficient, but still...
May 5, 2013 at 9:24 pm
niladri.primalink,
this one does not look right:
(SELECT TOP 1 ISNULL(status,0)status FROM submission WHERE fileid=file_id AND file_type=1)sub_status
TOP 1 with no ORDER BY means "random".
If there are 2 or more statuses for any...
May 5, 2013 at 7:38 pm
Jeff Moden (5/3/2013)
May 5, 2013 at 7:16 pm
TRACEY-320982 (5/3/2013)
Would the temp table not be collate at 850 so i dont have to change my update code aswell.
If 850 is the default collation for the datanase then the...
May 5, 2013 at 6:30 pm
SELECT E.empnum, RTRIM(C.lname) + ', ' + RTRIM(C.fname) AS Name,
RTRIM(SUBSTRING(C.dept,1,3)) AS Office,
...
May 3, 2013 at 10:45 pm
You may use COLLATE DATABASE_DEFAULT for columns coming from other databases.
Unless some tables in the database have not DB default collation.
Same for temp tables:
CREATE TABLE ##TS_ACCT (
[TS_ID] [nvarchar](100) COLLATE DATABASE_DEFAULT...
May 2, 2013 at 8:58 pm
I recon Lynn's code can be simplified.
Since both CTE's use the same grouping they may be merged in one:
with cte as (
select
Name,
...
May 2, 2013 at 8:10 pm
Viewing 15 posts - 1,966 through 1,980 (of 6,036 total)