Viewing 15 posts - 421 through 435 (of 444 total)
TVF may be. It can be used in FROM, you know.
create function SelectEmployees (@version varchar(10))
returns @t table (
-- fields compatible with RetailXX.dbo.Employees tables
)
as
begin
if @version = 'Dev'
insert @t
select *...
March 18, 2014 at 5:17 am
If i got it right ...
Suppose there's date range lookup table with N dates
create table #RangeLookup (
dt date
)
declare @strtDate date = '20140101'
declare @step int = 30
declare @N int...
March 18, 2014 at 2:08 am
It totally depends on what is the 'text'. Try patindex()
declare @txt varchar(100)
set @txt ='Te33 Text CD789 Te6t'
select substring(@txt,patindex('%[A-Z][A-Z][0-9][0-9][0-9]%', @txt),5)
Rgds
Serg
March 18, 2014 at 1:08 am
I wonder why only two records.
GROUP BY CRS.CN implies a separate row for every CN value in the join result.
May be you mean SUM (A+B+C) in the...
March 14, 2014 at 3:09 am
Noted REQUIRED_DATE is missing which defines the order of servicing.
March 13, 2014 at 6:45 am
At least try to get rid of inner loop
WHILE @sum_shipqty > 0.
1.Add running total column say RT to @Temp_Table.
2.After inserting to @Temp_Table compute RT. @Temp_Table is under...
March 13, 2014 at 3:57 am
If you need both subtotals and total see GROUP BY ROLLUP
March 10, 2014 at 7:27 am
OP's c# code generates all the words of given length L consisting of characters from the set {'!',..,'~'} .
When L<=0 it generates empty set of words.
March 6, 2014 at 11:20 pm
Try recursive TVF
create function testrec (@l int )
returns @t table
(c varchar(100))
as
begin
if @l > 0
begin
insert @t
select z.c + isnull(x.c,'')
from
(select top (ascii('~')...
March 6, 2014 at 1:56 am
You may hard code it as well
select * from [Temptable]
where namesrt in (100,599
, case @NAME when '410' then 410 when '430' then 430 end
...
February 26, 2014 at 4:31 am
...
CROSS APPLY A.xmldata.nodes('/Internationalization/contentRecords[@locale = sql:variable("@country")]/contentRecord') as N(X)
if i got it right and only contentRecords with the given @locale needed.
February 26, 2014 at 3:59 am
Try
select rating, min(AbsenceStartDate), max(AbsenceEndDate)
from (select r.*, AbsenceEndDate -
(select sum ( DATEDIFF (dd,AbsenceStartDate, AbsenceEndDate))
...
February 21, 2014 at 5:45 am
If you can't use MAX, use MIN 🙂
select -MIN(-SalesAmount)
from SalesOrder s
join ItemDetail i on i.ItemID = s.ItemID and i.CatID = 1
February 21, 2014 at 1:24 am
Then JOIN them
select x.R1,x.R2,x.R3, y.C1,y.C2,y.C3
from Database.table1 as x
join Database.table2 as y
to get all possible combinations aka cartesian product.
Restrict combinations using WHERE clause
http://technet.microsoft.com/en-us/library/ms191517(v=sql.105).aspx
February 20, 2014 at 5:13 am
Still wonder what you mean merge? Pls, provide sample src data and the result expected.
February 20, 2014 at 4:45 am
Viewing 15 posts - 421 through 435 (of 444 total)