Hi,
If you are using SQL Server 2016 or later you can use the String_Split function:
select value
from SL_ADDRESSES
cross apply STRING_SPLIT((AD_ADDRESS, CHAR(13))
where RTRIM(value) <> ''
Hope this help
https://www.imoveisemexposicao.com.br/imobiliarias-em-guarulhos
Hi,
Try something like this:
with CTE_Concat as
(
SELECT DISTINCT
a.secu_ID,
STUFF( (SELECT ', ' + s.Owner_ID
FROM MyTable as s
WHERE s.secu_ID = a.secu_ID
FOR XML PATH(''), TYPE).value('.', 'varchar(max)')...
Hi,
Try something like this:
SELECT DISTINCT
a.paymnt_group_id,
STUFF( (SELECT ', ' + s.paymnt_desc
FROM MyTable as s
WHERE s.paymnt_group_id = a.paymnt_group_id
FOR XML PATH(''), TYPE).value('.', 'varchar(100)')
,1, 2, '')...
Hi,
Try something like this:
with CTE_RK as
(
select
*,
RANK() OVER(ORDER BY bookpage) as RK
from MyTable
)
update CTE_RK
set mincounter = RK
Hope this helps.
http://www.imoveisemexposicao.com.br/imobiliarias-em-guarulhos
Try:
UPDATE FY
set FY.mon_shnm = pd.mon_shnm
FROM rptdata_monthly.dbo.rpt_FYInfo FY
INNER JOIN rptdata_monthly.dbo.dic_Period pd
ON pd.pd = FY.rptpd
WHERE
FY.rptpd = 391 and
FY.uci='BPA' and
FY.mon_shnm is null
Hope this helps...
Hi,
Try:
select
u.userID,
u.firstName,
u.lastName,
q.questionID,
q.description,
c.categoryID,
c.description,
a.answer_id,
a.answerText
from tbl_users as u
cross join tbl_questions as q
inner join tbl_category as c
on c.categoryID = q.categoryID
left...
Hi,
I do not know if I understood correctly but try:
SELECT
MBR_SSN_NBR,
max(MBR_HIST_SVC_CR_DT) as MBR_HIST_SVC_CR_DT
FROM DSNP.PR01_T_MBR_HIST
where
left(agty_id_cd, 1) = '9'
group by
MBR_SSN_NBR
Hope this helps.
http://www.imoveisemexposicao.com.br/imobiliarias-em-guarulhos
Try:
with CTE_Recursive as
(
select
i.ITEMID,
i.ITEMREFERENCEID,
h.PARENTNODEID
from @ITEM as i
inner join @ITEM_HIERARCHY as h
on h.ITEMID = i.ITEMID
where
i.ITEMREFERENCEID = 59
union all
select
h.ITEMID...
Hi,
Sorry but I do not understand what you said.
Doing a test with the script below got 4 rows in the result:
declare @ITEM Table
(ITEMID INT, ITEMREFERENCEID INT);
insert into @ITEM values
(1, 48),
(2, 50),
(3, 51),
(4, 52),
(5, 53),
(6, 54),
(7, 55),
(8, 56),
(9, 57),
(10, 58),
(11, 59)...
Try:
with CTE_Recursive as
(
select
i.ITEMID,
i.ITEMREFERENCEID,
h.PARENTNODEID
from ITEM as i
inner join ITEM_HIERARCHY as h
on h.ITEMID = i.ITEMID
where
i.ITEMREFERENCEID = 59
union all
select
h.ITEMID...
Hi,
Try something like this:
with CTE_Recursive as
(
select
i.ITEMID,
i.ITEMREFERENCEID,
h.PARENTNODEID
from ITEM as i
inner join ITEM_HIERARCHY as h
on h.ITEMID = i.ITEMID
where
i.ITEMREFERENCEID = 48
union all...
Hi,
Try something like this:
with
CTE_Q as
(
-- your query without order by
),
CTE_T as
(
select UPC
from CTE_Q
where Type in ('adjustment', 'sales')
group by UPC
having COUNT(distinct Type) = 2
)
select q.*
from CTE_T...
Hi,
bmacbmac, you can also try:
;with CTE_RN as
(
select
*,
ROW_NUMBER() OVER(PARTITION BY recordid, docno, bookno, pageno order by relatedid) as RN
from #temp
)
delete from CTE_RN
where RN > 1
Hope this helps...
Try:
SELECT t.HostID
FROM dbo.tblHosts as t
WHERE
not exists (SELECT d.HostID
FROM dbo.tblHolidays as d
WHERE
d.HostID = t.HostID AND
d.DateFrom <= @DepartureDate AND
d.DateTo >= @ArrivalDate)
Hope...
Hi,
If you want to enter a fixed value in this column try something like this:
insert into Table2 (Col1, Col2, Col3NotNull)
select Col1, Col2, 'D' from Table1
Hope this helps.
http://www.imoveisemexposicao.com.br/imobiliarias-em-guarulhos
Try changing the line below:
set @Last_LOC_Primary =
coalesce((select top 1 LOC_Primary from STK_Location order by LOC_Primary desc), 0);
Hope this helps.
http://www.imoveisemexposicao.com.br/imobiliarias-em-guarulhos
Try:
declare @Last_LOC_Primary int;
set @Last_LOC_Primary = (select top 1 LOC_Primary from STK_Location order by LOC_Primary desc);
insert into STK_Location (LOC_Primary, LOC_Code, LOC_Stock_Code)
select
ROW_NUMBER() OVER(ORDER BY s.STKCode) + @Last_LOC_Primary,
'MAIN'...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.