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
...r
inner join @ITEM_HIERARCHY as h
on h.ITEMID = r.PARENTNODEID
inner join @ITEM as i
on i.ITEMID = h.ITEMID
)
select top 1 * from CTE_Recursive
where PARENTNODEID is not null
order by PARENTNODEID
Hope this help...
...from CTE_Recursive as r
inner join @ITEM_HIERARCHY as h
on h.ITEMID = r.PARENTNODEID
inner join @ITEM as i
on i.ITEMID = h.ITEMID
)
select * from CTE_Recursive
order by PARENTNODEID
Hope this help.
http://www.imoveisemexposicao.com.br/imobiliarias-em-guarulhos
...from CTE_Recursive as r
inner join ITEM_HIERARCHY as h
on h.ITEMID = r.PARENTNODEID
inner join ITEM as i
on i.ITEMID = h.ITEMID
)
select * from CTE_Recursive
order by PARENTNODEID
Hope this help.
http://www.imoveisemexposicao.com.br/imobiliarias-em-guarulhos
...h.PARENTNODEID
from CTE_Recursive as r
inner join ITEM_HIERARCHY as h
on h.PARENTNODEID = r.ITEMID
inner join ITEM as i
on i.ITEMID = h.ITEMID
)
select * from CTE_Recursive
Hope this help.
http://www.imoveisemexposicao.com.br/imobiliarias-em-guarulhos
...UPC
from CTE_Q
where Type in ('adjustment', 'sales')
group by UPC
having COUNT(distinct Type) = 2
)
select q.*
from CTE_T as t
inner join CTE_Q as q
on q.UPC = t.UPC
order by q.upc, q.Type
Hope this helps...
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.