Viewing 15 posts - 8,461 through 8,475 (of 8,731 total)
Can you take a look at this article so we can help?
http://www.sqlservercentral.com/articles/Best+Practices/61537/
September 6, 2012 at 1:29 pm
Can you check the compatibility level of the database you're running the query on?
September 6, 2012 at 12:43 pm
If it takes more than one day to arrive.
SELECTFlightNumber,
ScheduleDeptDate,
ActualArrivalDay,
ActualArrivalDate,
CASE WHEN ActualArrivalDay >= DAY(ScheduleDeptDate)
THEN DATEADD( dd, ActualArrivalDay - 1, DATEADD( mm, DATEDIFF( mm, 0, ScheduleDeptDate), 0))
ELSE DATEADD( dd, ActualArrivalDay -...
September 6, 2012 at 11:51 am
Eugene Elutin (9/6/2012)
Luis Cazares (9/6/2012)
CELKO (9/6/2012)
September 6, 2012 at 11:35 am
CELKO (9/6/2012)
September 6, 2012 at 10:49 am
You're right, I missed that point.
I wasn't aware of your second post when I wrote mine, that's why my solution is so similar.
September 6, 2012 at 9:38 am
CELKO (9/6/2012)
SELECT CONVALESCE (upc, family_upc) AS item_upc, purchase_dateFROM Inventory
ORDER BY item_upc, purchase_date;
CONVALESCE? I can't find these on any SQL books, just medicine.
The design is poor? it...
September 6, 2012 at 9:35 am
That's not exactly the same result.
This might do it, but I can't test it:
SELECT Movimentos.Id,
Movimentos.Conta,
Movimentos.ValorAlt,
Movimentos.Dia,
Movimentos.Diario,
Movimentos.NumDiario,
Movimentos.Documento,
Movimentos.NumDoc,
Movimentos.ContaOrigem,
Movimentos.Descricao AS DescMov,
Movimentos.Valor,
Movimentos.Natureza,
Movimentos.Iva,
Movimentos.Selo,
Movimentos.TipoConta,
Movimentos.Entidade,
Movimentos.Moeda,
Movimentos.ClassOrgan,
Movimentos.ContaOrc,
Movimentos.Ano,
--Change in here
COALESCE( PlanoContas.Descricao, PlanoCentros.Descricao, PlanoFuncional.Descricao) AS DescConta,
Diarios.Descricao AS DescDiario,
DocumentosCBL.Descricao AS DescDoc,
Movimentos.Cambio,
Movimentos.CambioOrigem,
Movimentos.ValorOrigem,
Movimentos.TipoAfectacao,
Movimentos.CambioMAlt,
Movimentos.Linha,
Movimentos.Mes,
Movimentos.IdCabec,
Movimentos.PercNdedutivel,
Movimentos.IvaAutoLiquidacao,
Movimentos.TipoLancamento,
TiposLancamento.Descricao AS DescTipoLancamento
FROM...
September 6, 2012 at 9:24 am
Using Eugene suggestion (@index is declared int to prevent injection, but might create errors):
declare @index int = 2
DECLARE @sql varchar(MAX)
IF @index = 4
select CityInternalID, CityDefaultName, CityCountryID...
September 6, 2012 at 9:04 am
That might be because Eugene already had a #demo table and didn't want to drop ti and create a new one.
You can change the name to #demo.
If you avoid windowing...
September 6, 2012 at 7:57 am
IMO, different queries, same result. Just like:
SELECT CAST(SUBSTRING(CAST(FLOOR(NULLIF(ISNULL(COALESCE(1,NULL),NULL),NULL)) AS CHAR(1)),1,1) AS INT) AS one
and
SELECT 1 one
September 6, 2012 at 7:43 am
Do you need both values?
Or you're just adding them at the end?
If you're just adding them, you just need to drop the filter and keep one query.
September 6, 2012 at 7:41 am
I would say that those are different queries.
It's not the same thing to have
SELECT col1 FROM TableA
or
SELECT a.col1 AS mycol FROM TableA a
Even comments would make a query different, but...
September 6, 2012 at 7:33 am
Eugene is right, there's no way to have accurate results.
This are meant to be tools to help, not to automate a process.
I was going to suggest you to generate a...
September 6, 2012 at 7:09 am
Stewart "Arturius" Campbell (9/6/2012)
Good question, Ron, thanks.
There's an extra "=", other than that is valid.
It was a good question, but I still can't find a great use of APPLY in...
September 6, 2012 at 6:48 am
Viewing 15 posts - 8,461 through 8,475 (of 8,731 total)