Viewing 15 posts - 46 through 60 (of 444 total)
As well as only one value is needed scalar subquery will do
SELECT p.*,
value = ( SELECT TOP (1) [value]
FROM dbo.lkpTable l
WHERE l.ID = p.ID
ORDER BY l.Flag DESC...
December 4, 2015 at 3:19 am
Query optimizer is free to choose any order of WHERE predicates evaluation allowed by operations priority. So under circumstances the predicate type of what you commented out may be evaluated...
December 4, 2015 at 3:06 am
Use FOR XML PATH('') aggregation https://msdn.microsoft.com/en-us/library/ms189885(v=sql.120).aspx
Please provide consumable DDL and test data DML if you need more assitance.
December 3, 2015 at 6:16 am
If the maximum length of pakage could be reliably determined as for the test data case you can try static code
create table #orders (
n int,
l int
);
insert #orders(n,l) values
(100, 15),
(200, 18),
(201,...
December 3, 2015 at 4:16 am
The predicate
[Begin Time] = cast('2015-12-02' as date)
requires transactions to start exactly at 2015-12-02 00:00:00.000 .
Is it what you mean really?
December 3, 2015 at 3:14 am
Since EXCEL sheet update event should trigger data export into SQL server it's quite natural to automate the task at the EXCEL side with VBA script.
Provide more details if...
December 2, 2015 at 12:48 am
Cursor name shouldn't start with '@', Declare will fail with syntax error.
...
SET @SQLCommand1 = replace(N'
Declare RecCursor1 Cursor For
Select [Volume], [TRANSDATE] from <@TableName>'
,'<@TableName>', @TableName)
EXECUTE dbo.sp_executesql @sqlCommand1
Open RecCursor1
...
And it's good idea...
December 2, 2015 at 12:24 am
Try this
declare @s-2 varchar(8000) ='SENT REQUEST TO BREC TO VALADATE. WHY OOA LETTER WAS SENT. PER'
select stuff(
(select '.'+upper(left(item,cappos))+lower(substring(item,cappos+1,8000))
from(
select *, cappos= patindex('%[^ ]%',item)
from DelimitedSplit8K(@s,'.')
) t
order by ItemNumber
for...
December 1, 2015 at 5:46 am
Really, transaction table will eventually grow far beyond number of items (7500000). But I see nothing wrong with the above design. You need proper indexing, probably partitioning, enterprise feature.
December 1, 2015 at 12:59 am
Good question.
A title is misleading a bit. If the question is restricted to joins only, then hash join operator will have two inputs really.
November 30, 2015 at 5:05 am
It depends on what is considered 'normal'. For example
with t1 as(
-- select some initial data
), t2 as (
select --what you need
from t1
join HierarchyTable on --...
November 30, 2015 at 4:12 am
This code is language-independent
Select CHARINDEX(SUBSTRING('SAT',1,3), 'SUNMONTUEWEDTHUFRISAT') / 3 + 1
while DATEPART() is language dependent. Mixing them may be dangerous. Consider using language dependent code instead
select wdn
from (
select
wdn...
November 30, 2015 at 2:32 am
2GB limit is still here even in 2016. Why you need to store 20GB of data as a single value in MS SQL db? Definitely it's not the purpose...
November 30, 2015 at 12:52 am
Another option is to figure out the first and last day of week within the interval and get the number of weeks . Using iTVF
create function NumDOWBetween (@StartDate DATETIME,...
November 27, 2015 at 7:23 am
Yes, you can follow the same track.
CREATE table categoria(
[id_categoria] [int] NOT NULL,
[categoria] [nvarchar](50) NULL
);
INSERT INTO categoria
VALUES
(1, 'horror'),
(2, 'fantascienza');
CREATE table film(
[id_film] [int] NOT...
November 27, 2015 at 4:14 am
Viewing 15 posts - 46 through 60 (of 444 total)