Viewing 15 posts - 196 through 210 (of 1,438 total)
Something like this?
SELECT cod_rep_fiscal,
COUNT(CASE WHEN cod_met_tributario = 'tp1' THEN cod_met_tributario END) AS tp1,
COUNT(CASE WHEN cod_met_tributario =...
February 25, 2015 at 5:16 am
This is specific to XML, it's using the column name as part of the results. There's no data type conversion going on.
February 24, 2015 at 2:31 am
You need to provide a name for the column
SELECT ' '+ item AS item FROM #tbl FOR XML PATH('')
February 24, 2015 at 2:11 am
This should work for you
CREATE TYPE dbo.HierTVP AS TABLE
(
id int,
childname nvarchar(max),
parentid int,
parentname nvarchar(max)
)
GO
CREATE FUNCTION dbo.GetHier(@parentid INT, @HierTVP dbo.HierTVP READONLY)
RETURNS XML
WITH RETURNS NULL ON NULL INPUT
BEGIN RETURN
(SELECT childname AS...
February 23, 2015 at 9:28 am
This may be possible with table valued parameters, can you post a bit more information on what you have.
February 23, 2015 at 8:55 am
You'll need a function for this
CREATE FUNCTION dbo.GetHier(@parentid INT)
RETURNS XML
WITH RETURNS NULL ON NULL INPUT
BEGIN RETURN
(SELECT childname AS "@name",
dbo.GetHier(id)
...
February 23, 2015 at 8:39 am
Jeff Moden (2/21/2015)
CELKO (2/20/2015)
I'm guessing he'll push that functionality out to the app server!
There's certainly a good argument that that is where the logic should be.
Here is the formula...
February 22, 2015 at 1:33 am
Done a bit of digging here, using a SQLCLR equivalent to the OPs script (source below)
using System;
using System.Data.SqlTypes;
using System.Text;
using System.Security.Cryptography; // Will need a reference to System.Security
public partial class UserDefinedFunctions
{
...
February 19, 2015 at 9:52 am
This should work for you
with cte as (
select ID,STATO,DATEANDTIME,
row_number() over (partition by ID ORDER BY DATEANDTIME) -
row_number() over (partition by ID, STATO ORDER BY DATEANDTIME) as grp
from MYTABLE)
select ID,STATO,DATEANDTIME,
row_number() over...
February 19, 2015 at 3:37 am
Untested, but may be as simple as changing
group by Product
to
group by LEFT(Product, charindex(' ', Product) - 1)
February 18, 2015 at 5:23 am
Try this
AND B.MasterAccount NOT LIKE '%[^0]%'
February 17, 2015 at 8:07 am
Viewing 15 posts - 196 through 210 (of 1,438 total)