Query: SQL Server Book Recommendations

Hi folks!
There are Books Online. There are the SAP Notes and Documents created by people like Jürgen Thomas (THANKS!!!) ...
There are many sources of information in the WWW - blogs, documents, discussons ...
And there are many BOOKS. Too many ...
I ask you to recommend your favourite books about SQL Server.
Your recommendations should help all of us to buy those books which are helpful ...
Kind regards, Rudi

Hi Rudolf,
  Do you focus only on SQL server, not including Windows Server Failover Cluster and SAP? If yes, I  recommend you to ask in MSDN -> Database Engine.
Because this is a SAP on SQL forum, I will talk a little bit about WSFC and SAP. Here is my MATERIAL list. Hope this helps.
PS: These are very useful for troubleshooting and performance optimization. Regarding to reviews, there are so many people wrote in Amazon in great detail. I will skip it.
1. Search "Failover Cluster" from MS TechEd 2008~2014
2. Search "SQL Server Performance/Query/execution plan/AlwaysOn" from MS TechEd 2008~2014
3. A book "Microsoft SQL Server 2005 administrator’s companion"
3.5 Troushooting Sql Server ( Troubleshooting SQL Server: A Guide for the Accidental DBA )
4. A material from SAP course "BC 490: ABAP Performance & Tuning"
5. CD 262: Tune Your Custom ABAP Code.
6. Performance Do’s and Don’ts – ABAP: http://service.sap.com/performance
7. SAP performance optimization guide: http://www.amazon.com/SAP-Performance-Optimization-Guide-Edition/dp/1592293689
8. Juergen best practices: http://scn.sap.com/docs/DOC-1006
9. SAP DBA Cockpit and Microsoft SQL Server | SCN
10. DBA Cockpit SQL scripts: http://blogs.msdn.com/b/saponsqlserver/archive/2007/06/05/sap-dbacockpit-and-some-related-sql-scripts-part-1.aspx
11. Search "Enhancment Package/Solution Manager" from SAP TechEd

Similar Messages

  • I want to query sql server database from oracle

    i want to query sql server database from oracle
    can anyone help me in this regard

    First of all - you are in the wrong forum.
    Look either for the Database general or search for Transparant / Heterogenous Gateways.
    cu
    Andreas

  • MS Access querying SQL Server: How to configure Network ACL?

    I need to set up a highly restrictive ACL for access to a particular SQL server in our network.  This ACL will reside on our core switch at the "front door" of our network and permit access to the SQL server only using the ports that
    are necessary.  The purpose is to A) Try to keep unauthorized users from gaining access to the host server and B) Should someone somehow gain unauthorized access to the host server. keep them from being able to "hop off" to other PC's on
    the network. 
    The server will be accessed by clients using MS Access to query the SQL database and bring back reports.  A few admins are actually able to make minor changes to the database such as updating a user list or location list. In other words, both
    read and write access is needed to the SQL database.
    I know that the default SQL server port is 1433, but according to a Microsoft Support article I read, "client ports are assigned a random value between 1024 and 5000".
    I was really hoping I could just put something like "permit PC1 access to SQL Server on Port 1433" in my ACL, but after reading the MS Support article it sounds like I've got to allow almost 4,000 ports through?
    Could someone help demystify this for me so I can build the right ACL?

    The tool to use is SQL Server Configuration Management.
    But what you can configure is which port SQL Server listens to. Which port the client listens to is not controllable as far as I know. But that can of course be many, since a client can have many connections to SQL Server. (And the range is not
    restricted to 1024-5000. I connected over TCP locally, and I see this with netstat -a
      TCP    127.0.0.1:6621         NATSUMORI:ms-sql-s     ESTABLISHED
    Then again, I don't see why you would have to open any ports for the clients at all. I have never heard of this being a problem.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Query sql server- oracle

    hi, i have this query in sql server :
    select *
    from x, com y, com z
    where x.a *= y.a and x.b *=z.a
    in oracle it's not supported ( i think) a query like:
    select *
    from x, com y, com z
    where x.a (+)= y.a and x.b (+)=z.a
    what's the solution??!
    thanks!

    This may not be best solution I guess - The query is
    untested .
    select people.name , max(b_city) , max(c_city) from
    select people.name, b_city.name b_city , null r_city
    from people, city b_city, city r_city
    where people.id_birthplace(+)=b_city.id
    union all
    select people.name, null b_city , r_city.name
    from people, city r_city
    where people.id_residence(+)=r_city.id
    group by people.nameWell after fixing your typos...
    SQL> ed
    Wrote file afiedt.buf
      1  WITH people as (select 1 as id, 'Fred' as name, 1 as id_birthplace, 1 as id_residence from dual union all
      2                  select 2, 'Bob', 3, null from dual union all
      3                  select 3, 'Jim', null, 2 from dual)
      4      ,city as   (select 1 as id, 'London' as name from dual union all
      5                  select 2, 'Birmingham' from dual union all
      6                  select 3, 'Manchester' from dual)
      7  -- END OF TEST DATA
      8  select name , max(b_city) , max(r_city) from (
      9    select people.name, b_city.name b_city , null r_city
    10    from   people, city b_city, city r_city
    11    where  people.id_birthplace(+)=b_city.id
    12    union all
    13    select people.name, null b_city , r_city.name
    14    from   people, city r_city
    15    where  people.id_residence(+)=r_city.id
    16    )
    17* group by name
    SQL> /
    NAME MAX(B_CITY MAX(R_CITY
         Birmingham Manchester
    Bob  Manchester
    Fred London     London
    Jim             Birmingham
    SQL>Seems that we've gained a new unnamed person

  • Error en Query : [SQL Server] Error de Division entre 0

    Maestros !!
    Tengo este problema:
    Al ejecutar una query me figura este error " [SQL Server] Error de Division entre 0 ". Entiendo el error, cualquier numero divido por 0 arroja este problema, mi pregunta es como lo hago para no considerar las operaciones con resultado 0. Al revisar las operaciones que esta resumiendo la funcion AVG existen operaciones con resultado 0.
    La query es la siguiente:
    SELECT T3.FirmCode, T3.FirmName, SUM(T1.Quantity) as 'Cantidades', AVG(T1.Price) as 'Precio Venta Promedio', AVG(T1.StockPrice) as 'Costo Promedio', SUM(T1.LineTotal) as 'Venta Neta', AVG((1-((T1.Quantity*T1.StockPrice)/T1.LineTotal))*100) as 'Margen Almacen 01'
    INTO #FV01 FROM OINV T0  INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry  INNER JOIN OITM T2 ON T2.ItemCode = T1.ItemCode LEFT OUTER JOIN OMRC T3 ON T3.FirmCode = T2.FirmCode
    WHERE T0.DocDate >= '[%0]' and T0.DocDate <= '[%1]'  and ISNULL(T0.Indicator,'') <> 'NL' and T0.DocType ='I' and T1.WhsCode ='01'
    GROUP BY T3.FirmCode, T3.FirmName
    ORDER BY T3.FirmName
    SELECT T3.FirmCode, T3.FirmName, SUM(T1.Quantity) as 'Cantidades', AVG(T1.Price) as 'Precio Venta Promedio', AVG(T1.StockPrice) as 'Costo Promedio', SUM(T1.LineTotal) as 'Venta Neta', AVG((1-((T1.Quantity*T1.StockPrice)/T1.LineTotal))*100) as 'Margen Almacen 02'
    INTO #FV02 FROM OINV T0  INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry  INNER JOIN OITM T2 ON T2.ItemCode = T1.ItemCode LEFT OUTER JOIN OMRC T3 ON T3.FirmCode = T2.FirmCode
    WHERE T0.DocDate >= '[%0]' and T0.DocDate <= '[%1]'  and ISNULL(T0.Indicator,'') <> 'NL' and T0.DocType ='I' and T1.WhsCode ='02'
    GROUP BY T3.FirmCode, T3.FirmName
    ORDER BY T3.FirmName
    SELECT T3.FirmCode, T3.FirmName, SUM(T1.Quantity) as 'Cantidades', AVG(T1.Price) as 'Precio Venta Promedio', AVG(T1.StockPrice) as 'Costo Promedio', SUM(T1.LineTotal) as 'Venta Neta', AVG((1-((T1.Quantity*T1.StockPrice)/T1.LineTotal))*100) as 'Margen Almacen 03'
    INTO #FV03 FROM OINV T0  INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry  INNER JOIN OITM T2 ON T2.ItemCode = T1.ItemCode LEFT OUTER JOIN OMRC T3 ON T3.FirmCode = T2.FirmCode
    WHERE T0.DocDate >= '[%0]' and T0.DocDate <= '[%1]'  and ISNULL(T0.Indicator,'') <> 'NL' and T0.DocType ='I' and T1.WhsCode ='03'
    GROUP BY T3.FirmCode, T3.FirmName
    ORDER BY T3.FirmName
    SELECT T3.FirmCode, T3.FirmName, SUM(T1.Quantity) as 'Cantidades', AVG(T1.Price) as 'Precio Venta Promedio', AVG(T1.StockPrice) as 'Costo Promedio', SUM(T1.LineTotal) as 'Venta Neta', AVG((1-((T1.Quantity*T1.StockPrice)/T1.LineTotal))*100) as 'Margen Almacen 04'
    INTO #FV04 FROM OINV T0  INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry  INNER JOIN OITM T2 ON T2.ItemCode = T1.ItemCode LEFT OUTER JOIN OMRC T3 ON T3.FirmCode = T2.FirmCode
    WHERE T0.DocDate >= '[%0]' and T0.DocDate <= '[%1]'  and ISNULL(T0.Indicator,'') <> 'NL' and T0.DocType ='I' and T1.WhsCode ='04'
    GROUP BY T3.FirmCode, T3.FirmName
    ORDER BY T3.FirmName
    SELECT T3.FirmCode, T3.FirmName, SUM(T1.Quantity) as 'Cantidades', AVG(T1.Price) as 'Precio Venta Promedio', AVG(T1.StockPrice) as 'Costo Promedio', SUM(T1.LineTotal) as 'Venta Neta', AVG((1-((T1.Quantity*T1.StockPrice)/T1.LineTotal))*100) as 'Margen Almacen 05'
    INTO #FV05 FROM OINV T0  INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry  INNER JOIN OITM T2 ON T2.ItemCode = T1.ItemCode LEFT OUTER JOIN OMRC T3 ON T3.FirmCode = T2.FirmCode
    WHERE T0.DocDate >= '[%0]' and T0.DocDate <= '[%1]'  and ISNULL(T0.Indicator,'') <> 'NL' and T0.DocType ='I' and T1.WhsCode ='05'
    GROUP BY T3.FirmCode, T3.FirmName
    ORDER BY T3.FirmName
    SELECT T3.FirmCode, T3.FirmName, SUM(T1.Quantity) as 'Cantidades', AVG(T1.Price) as 'Precio Venta Promedio', AVG(T1.StockPrice) as 'Costo Promedio', SUM(T1.LineTotal) as 'Venta Neta', AVG((1-((T1.Quantity*T1.StockPrice)/T1.LineTotal))*100) as 'Margen Almacen 06'
    INTO #FV06 FROM OINV T0  INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry  INNER JOIN OITM T2 ON T2.ItemCode = T1.ItemCode LEFT OUTER JOIN OMRC T3 ON T3.FirmCode = T2.FirmCode
    WHERE T0.DocDate >= '[%0]' and T0.DocDate <= '[%1]'  and ISNULL(T0.Indicator,'') <> 'NL' and T0.DocType ='I' and T1.WhsCode ='06'
    GROUP BY T3.FirmCode, T3.FirmName
    ORDER BY T3.FirmName
    SELECT T3.FirmCode, T3.FirmName, SUM(T1.Quantity) as 'Cantidades', AVG(T1.Price) as 'Precio Venta Promedio', AVG(T1.StockPrice) as 'Costo Promedio', SUM(T1.LineTotal) as 'Venta Neta', AVG((1-((T1.Quantity*T1.StockPrice)/T1.LineTotal))*100) as 'Margen Almacen 07'
    INTO #FV07 FROM OINV T0  INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry  INNER JOIN OITM T2 ON T2.ItemCode = T1.ItemCode LEFT OUTER JOIN OMRC T3 ON T3.FirmCode = T2.FirmCode
    WHERE T0.DocDate >= '[%0]' and T0.DocDate <= '[%1]'  and ISNULL(T0.Indicator,'') <> 'NL' and T0.DocType ='I' and T1.WhsCode ='07'
    GROUP BY T3.FirmCode, T3.FirmName
    ORDER BY T3.FirmName
    SELECT T3.FirmCode, T3.FirmName, SUM(T1.Quantity) as 'Cantidades', AVG(T1.Price) as 'Precio Venta Promedio', AVG(T1.StockPrice) as 'Costo Promedio', SUM(T1.LineTotal) as 'Venta Neta', AVG((1-((T1.Quantity*T1.StockPrice)/T1.LineTotal))*100) as 'Margen Almacen 08'
    INTO #FV08 FROM OINV T0  INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry  INNER JOIN OITM T2 ON T2.ItemCode = T1.ItemCode LEFT OUTER JOIN OMRC T3 ON T3.FirmCode = T2.FirmCode
    WHERE T0.DocDate >= '[%0]' and T0.DocDate <= '[%1]'  and ISNULL(T0.Indicator,'') <> 'NL' and T0.DocType ='I' and T1.WhsCode ='08'
    GROUP BY T3.FirmCode, T3.FirmName
    ORDER BY T3.FirmName
    SELECT T3.FirmCode, T3.FirmName, SUM(T1.Quantity) as 'Cantidades', AVG(T1.Price) as 'Precio Venta Promedio', AVG(T1.StockPrice) as 'Costo Promedio', SUM(T1.LineTotal) as 'Venta Neta', AVG((1-((T1.Quantity*T1.StockPrice)/T1.LineTotal))*100) as 'Margen Almacen 09'
    INTO #FV09 FROM OINV T0  INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry  INNER JOIN OITM T2 ON T2.ItemCode = T1.ItemCode LEFT OUTER JOIN OMRC T3 ON T3.FirmCode = T2.FirmCode
    WHERE T0.DocDate >= '[%0]' and T0.DocDate <= '[%1]'  and ISNULL(T0.Indicator,'') <> 'NL' and T0.DocType ='I' and T1.WhsCode ='09'
    GROUP BY T3.FirmCode, T3.FirmName
    ORDER BY T3.FirmName
    SELECT T3.FirmCode, T3.FirmName, SUM(T1.Quantity) as 'Cantidades', AVG(T1.Price) as 'Precio Venta Promedio', AVG(T1.StockPrice) as 'Costo Promedio', SUM(T1.LineTotal) as 'Venta Neta', AVG((1-((T1.Quantity*T1.StockPrice)/T1.LineTotal))*100) as 'Margen Almacen 11'
    INTO #FV11 FROM OINV T0  INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry  INNER JOIN OITM T2 ON T2.ItemCode = T1.ItemCode LEFT OUTER JOIN OMRC T3 ON T3.FirmCode = T2.FirmCode
    WHERE T0.DocDate >= '[%0]' and T0.DocDate <= '[%1]'  and ISNULL(T0.Indicator,'') <> 'NL' and T0.DocType ='I' and T1.WhsCode ='11'
    GROUP BY T3.FirmCode, T3.FirmName
    ORDER BY T3.FirmName
    SELECT T3.FirmCode, T3.FirmName, SUM(T1.Quantity) as 'Cantidades', AVG(T1.Price) as 'Precio Venta Promedio', AVG(T1.StockPrice) as 'Costo Promedio', SUM(T1.LineTotal) as 'Venta Neta', AVG((1-((T1.Quantity*T1.StockPrice)/T1.LineTotal))*100) as 'Margen Almacen 12'
    INTO #FV12 FROM OINV T0  INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry  INNER JOIN OITM T2 ON T2.ItemCode = T1.ItemCode LEFT OUTER JOIN OMRC T3 ON T3.FirmCode = T2.FirmCode
    WHERE T0.DocDate >= '[%0]' and T0.DocDate <= '[%1]'  and ISNULL(T0.Indicator,'') <> 'NL' and T0.DocType ='I' and T1.WhsCode IN('12','12A','12B','12C')
    GROUP BY T3.FirmCode, T3.FirmName
    ORDER BY T3.FirmName
    SELECT T3.FirmCode, T3.FirmName, SUM(T1.Quantity) as 'Cantidades', AVG(T1.Price) as 'Precio Venta Promedio', AVG(T1.StockPrice) as 'Costo Promedio', SUM(T1.LineTotal) as 'Venta Neta', AVG((1-((T1.Quantity*T1.StockPrice)/T1.LineTotal))*100) as 'Margen Almacen 14'
    INTO #FV14 FROM OINV T0  INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry  INNER JOIN OITM T2 ON T2.ItemCode = T1.ItemCode LEFT OUTER JOIN OMRC T3 ON T3.FirmCode = T2.FirmCode
    WHERE T0.DocDate >= '[%0]' and T0.DocDate <= '[%1]'  and ISNULL(T0.Indicator,'') <> 'NL' and T0.DocType ='I' and T1.WhsCode ='14'
    GROUP BY T3.FirmCode, T3.FirmName
    ORDER BY T3.FirmName
    SELECT T3.FirmCode, T3.FirmName, SUM(T1.Quantity) as 'Cantidades', AVG(T1.Price) as 'Precio Venta Promedio', AVG(T1.StockPrice) as 'Costo Promedio', SUM(T1.LineTotal) as 'Venta Neta', AVG((1-((T1.Quantity*T1.StockPrice)/T1.LineTotal))*100) as 'Margen Almacen 20'
    INTO #FV20 FROM OINV T0  INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry  INNER JOIN OITM T2 ON T2.ItemCode = T1.ItemCode LEFT OUTER JOIN OMRC T3 ON T3.FirmCode = T2.FirmCode
    WHERE T0.DocDate >= '[%0]' and T0.DocDate <= '[%1]'  and ISNULL(T0.Indicator,'') <> 'NL' and T0.DocType ='I' and T1.WhsCode ='20'
    GROUP BY T3.FirmCode, T3.FirmName
    ORDER BY T3.FirmName
    SELECT T3.FirmCode, T3.FirmName, SUM(T1.Quantity) as 'Cantidades', AVG(T1.Price) as 'Precio Venta Promedio', AVG(T1.StockPrice) as 'Costo Promedio', SUM(T1.LineTotal) as 'Venta Neta', AVG((1-((T1.Quantity*T1.StockPrice)/T1.LineTotal))*100) as 'Margen Almacen 221'
    INTO #FV21 FROM OINV T0  INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry  INNER JOIN OITM T2 ON T2.ItemCode = T1.ItemCode LEFT OUTER JOIN OMRC T3 ON T3.FirmCode = T2.FirmCode
    WHERE T0.DocDate >= '[%0]' and T0.DocDate <= '[%1]'  and ISNULL(T0.Indicator,'') <> 'NL' and T0.DocType ='I' and T1.WhsCode ='221'
    GROUP BY T3.FirmCode, T3.FirmName
    ORDER BY T3.FirmName
    SELECT T3.FirmCode, T3.FirmName, SUM(T1.Quantity) as 'Cantidades', AVG(T1.Price) as 'Precio Venta Promedio', AVG(T1.StockPrice) as 'Costo Promedio', SUM(T1.LineTotal) as 'Venta Neta', AVG((1-((T1.Quantity*T1.StockPrice)/T1.LineTotal))*100) as 'Margen Almacen 22'
    INTO #FV22 FROM OINV T0  INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry  INNER JOIN OITM T2 ON T2.ItemCode = T1.ItemCode LEFT OUTER JOIN OMRC T3 ON T3.FirmCode = T2.FirmCode
    WHERE T0.DocDate >= '[%0]' and T0.DocDate <= '[%1]'  and ISNULL(T0.Indicator,'') <> 'NL' and T0.DocType ='I' and T1.WhsCode ='22'
    GROUP BY T3.FirmCode, T3.FirmName
    ORDER BY T3.FirmName
    SELECT T3.FirmCode, T3.FirmName, SUM(T1.Quantity) as 'Cantidades', AVG(T1.Price) as 'Precio Venta Promedio', AVG(T1.StockPrice) as 'Costo Promedio', SUM(T1.LineTotal) as 'Venta Neta', AVG((1-((T1.Quantity*T1.StockPrice)/T1.LineTotal))*100) as 'Margen Almacen 23'
    INTO #FV23 FROM OINV T0  INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry  INNER JOIN OITM T2 ON T2.ItemCode = T1.ItemCode LEFT OUTER JOIN OMRC T3 ON T3.FirmCode = T2.FirmCode
    WHERE T0.DocDate >= '[%0]' and T0.DocDate <= '[%1]'  and ISNULL(T0.Indicator,'') <> 'NL' and T0.DocType ='I' and T1.WhsCode ='23'
    GROUP BY T3.FirmCode, T3.FirmName
    ORDER BY T3.FirmName
    ---SELECCION DE DATOS
    SELECT T3.FirmCode, T3.FirmName as 'Proveedor',
    (Select T201.[Margen Almacen 01] From  #FV01 T201 where T201.[FirmCode] = T3.FirmCode) as 'Margen Venta Local 01',
    (Select T202.[Margen Almacen 02] From  #FV02 T202 where T202.[FirmCode] = T3.FirmCode) as 'Margen Venta Local 02',
    (Select T203.[Margen Almacen 03] From  #FV03 T203 where T203.[FirmCode] = T3.FirmCode) as 'Margen Venta Local 03',
    (Select T204.[Margen Almacen 04] From  #FV04 T204 where T204.[FirmCode] = T3.FirmCode) as 'Margen Venta Local 04',
    (Select T205.[Margen Almacen 05] From  #FV05 T205 where T205.[FirmCode] = T3.FirmCode) as 'Margen Venta Local 05',
    (Select T206.[Margen Almacen 06] From  #FV06 T206 where T206.[FirmCode] = T3.FirmCode) as 'Margen Venta Local 06',
    (Select T207.[Margen Almacen 07] From  #FV07 T207 where T207.[FirmCode] = T3.FirmCode) as 'Margen Venta Local 07',
    (Select T208.[Margen Almacen 08] From  #FV08 T208 where T208.[FirmCode] = T3.FirmCode) as 'Margen Venta Local 08',
    (Select T209.[Margen Almacen 09] From  #FV09 T209 where T209.[FirmCode] = T3.FirmCode) as 'Margen Venta Local 09',
    (Select T211.[Margen Almacen 11] From  #FV11 T211 where T211.[FirmCode] = T3.FirmCode) as 'Margen Venta Local 11',
    (Select T212.[Margen Almacen 12] From  #FV12 T212 where T212.[FirmCode] = T3.FirmCode) as 'Margen Venta Local 12',
    (Select T214.[Margen Almacen 14] From  #FV14 T214 where T214.[FirmCode] = T3.FirmCode) as 'Margen Venta Local 14',
    (Select T220.[Margen Almacen 20] From  #FV20 T220 where T220.[FirmCode] = T3.FirmCode) as 'Margen Venta Local 20',
    (Select T221.[Margen Almacen 221] From  #FV21 T221 where T221.[FirmCode] = T3.FirmCode) as 'Margen Venta Local 221',
    (Select T222.[Margen Almacen 22] From  #FV22 T222 where T222.[FirmCode] = T3.FirmCode) as 'Margen Venta Local 22',
    (Select T223.[Margen Almacen 23] From  #FV23 T223 where T223.[FirmCode] = T3.FirmCode) as 'Margen Venta Local 23'
    INTO #RESULT FROM OITM T2 LEFT OUTER JOIN OMRC T3 ON T3.FirmCode =T2.FirmCode
    GROUP BY T3.FirmCode, T3.FirmName
    ORDER BY T3.FirmName
    SELECT * FROM #RESULT where isnull([Margen Venta Local 01],0) <> 0
    or isnull([Margen Venta Local 02], 0) <> 0
    or isnull([Margen Venta Local 03], 0) <> 0
    or isnull([Margen Venta Local 04], 0) <> 0
    or isnull([Margen Venta Local 05], 0) <> 0
    or isnull([Margen Venta Local 06], 0) <> 0
    or isnull([Margen Venta Local 07], 0) <> 0
    or isnull([Margen Venta Local 08], 0) <> 0
    or isnull([Margen Venta Local 09], 0) <> 0
    or isnull([Margen Venta Local 11], 0) <> 0
    or isnull([Margen Venta Local 12], 0) <> 0
    or isnull([Margen Venta Local 14], 0) <> 0
    or isnull([Margen Venta Local 20], 0) <> 0
    or isnull([Margen Venta Local 221], 0) <> 0
    or isnull([Margen Venta Local 22], 0) <> 0
    or isnull([Margen Venta Local 23], 0) <> 0
    ---FIN
    Agradeciendo vuestra ayuda.

    Buenas Tardes Eloy
    Al revisar todas las transacciones una a una, ninguna de ellas en el campo T1.LineTotal tiene como resultado el valor 0 ya que el campo T1.LineTotal es el monto neto de la venta (sin impuestos) y este nunca es 0 ya que tenemos validaciones antes de crear el documento.
    El valor 0 aparece como resultado de esta operación ((1-((T1.Quantity*T1.StockPrice)/T1.LineTotal))*100), ya que en varios ventas se vendió al mismo precio del costo del producto debido a promociones o liquidaciones de stock, por lo tanto el resultado 0 en dicha operación es correcto.
    Cuando a estas operación le aplico la función AVG para resumir datos comienza el problema.
    Que me sugieres que realice?
    Agradeciendo tu ayuda.

  • Undisplayed Physical query SQL Server 208

    Hi,
    I am querrig an SQL Server 2008 database with OBIEE. But the physical query syntax isn't dispalayed in the nqQuery.
    I got a message seems to History unfound.
    Is there any way to get the physical query on database different from oracle like SQL server or XML...?
    Thanks

    Can you check the logging level of the user you are logging as ?
    I guess because the logging level is not defined hence no history for this user !!

  • Undisplayed Physical query SQL Server 2008

    Hi,
    I am querrig an SQL Server 2008 database with OBIEE. But the physical query syntax isn't dispalayed in the nqQuery.
    I got a message seems to History unfound.
    Is there any way to get the physical query on database different from oracle like SQL server or XML...?
    Thanks

    Can you check the logging level of the user you are logging as ?
    I guess because the logging level is not defined hence no history for this user !!

  • PS Query, SQL Server and prompts

    Hello,
    I try to create a query with a where clause like this :
    field = :1 or :1 = ' '
    so the SQL is :
    SELECT A.F1
    FROM PS_TAB A
    WHERE A.F2 = :1
    OR :1 = ' '
    My problem is when I execute it, if I fill the prompt I have the message :
    "A SQL error occurred. Please consult your system log for details.
    Erreur lors de l'exécution requête en raison d'une erreur SQL, Code=8010, Message=[Microsoft][SQL Native Client][SQL Server]Invalid column name 'ACC010'. (50,380)"
    and if I don't fill the prompt I have :
    "A SQL error occurred. Please consult your system log for details.
    Erreur lors de l'exécution requête en raison d'une erreur SQL, Code=8601, Message=[Microsoft][SQL Native Client][SQL Server]Executing SQL directly; no cursor. [Microsoft][SQL Native Client][SQL Server]Incorrect syntax near '='. [Microsoft][SQL Native Client][SQL Server]Statement(s) could not be prepared. (SQLSTATE 37000) 8180 (50,380)"
    Do you know how I can solve this ?
    I am on SQL Server 2005 and peoplesoft 8.45.
    Thanks in advance for your help.

    Thanks to take a look at my problem but I have just solved it (I just had to put in my criteria ' ' = :1 instead of :1 = ' '). So you can forget.

  • Querying SQL server table from Oracle database 11g

    Hi all
    We are using oracle database 11g R2 on REL 5 and i have an SQL server database used by one of our application.
    In my Oracle database, i want to query one table in my SQL server database and to link it in a table in Oracle database to compare data.
    Is there a way like database link or something else to do this need>
    Please send a link or pots here step by step the way on how to accomplish my query.
    Thank you.

    Yes, you can set up your SQL Server as an external database link, using Oracle Heterogeneous Services with SQL Server as an ODBC connection (easier to do if your Oracle server is a Windows server, a little more tricky if your Oracle server is *nix based)
    Here's the documentation... for 11gR2
    http://www.oracle.com/pls/db112/search?remark=quick_search&word=heterogeneous+services

  • Formulating a count query - sql server 2012

    Hello,
    I am quite new to SQL and even though I can handle simple queries I have run into a problem. Maybe you can help :-)
    This is how the table I want to query from is structured:
       id   From                                 To                      
        Anomalies         
       1         01-08-2014 00:00:00       01-08-2014 00:30:00        24
       2       01-08-2014 00:00:00       01-08-2014 00:30:00
     80
       3         01-08-2014 00:00:00       01-08-2014 00:30:00        11
       4         01-08-2014 00:00:00       01-08-2014 00:30:00        10
       5         01-08-2014 00:00:00       01-08-2014 00:30:00        90
       1         01-08-2014 00:30:00       01-08-2014 01:00:00        20
       2         01-08-2014 00:30:00       01-08-2014 01:00:00        74
       3         01-08-2014 00:30:00       01-08-2014 01:00:00        11
       4         01-08-2014 00:30:00       01-08-2014 01:00:00        100
       5         01-08-2014 00:30:00       01-08-2014 01:00:00         98
    The problem is to write a query that will return the number of anomalies per department for the month of, say, July 2014. The final result set should have 5 records.
    Does anyone have any ideas?
    Thx

    Thanks. The month condition is what I am after though :-) Would thiS WORK:select id, sum (Anomalies) as monthlySum from yourtable
    WHERE Datename(month, From) = 'July' and DatenaME(month, To) = 'July'
    group by id?Thanks.

  • Querying SQL Server Data

    I have to pull information from a SQLServer in a PL/SQL procedure. I have tried to create a database link, but that hasn't worked. Any Ideas?
    Thanks.

    through Oracle JVM try to create a java program using JDBC read from SQLSERVER and write into oracle table, this can called through oracle proceudure

  • Outer join query for SQL server from Oracle

    Hi All,
    My question is regarding making queries from Oracle to SQL Server database thorugh DBLink.
    In my oracle database I have a DBLink emp.world for SQL Server database.
    I need to query SQL Server data from oracle (so that this query can be combined with other oracle tables).
    Query is given below:
    SELECT
            a."EmpID" as "Employee ID",
            a."EmpStatus" "Employee Status"
            b."EmpSub" as "Employee Subjects"
    FROM
            [email protected] a
            left outer join [email protected] b on a."EmpID" = b."suEmpID"
    ORDER BY  a."EmpID";My problem is when I run the same query from oracle, it does not show the EmpID that does not exist in Subjects table, but when run from actual SQL Server database, it shows all the records.
    Samples are given below:
    Run from Oracle
    Employee ID      Employee Status     Employee Subjects
    101                     Active                     Maths
    102                     Active                     Maths
    102                     Active                     Physics
    104                   Inactive                  Chemistry
    Run form SQL Server
    Employee ID      Employee Status     Employee Subjects
    101                     Active                     Maths
    102                     Active                     Maths
    102                     Active                     Physics
    103                 Active                       NULL
    104             Inactive            ChemistryI am not sure why in oracle outer join for SQL server tables is not working. What is the right way for outer join in this case.
    I am using oracle database 10gR2 and SQL Server 2005.
    Please Help.
    Thanks.

    SELECT
    a."EmpID" as "Employee ID",
    a."EmpStatus" "Employee Status"
    b."EmpSub" as "Employee Subjects"
    FROM
    [email protected] a
    left outer join [email protected] b on a."EmpID" = b."suEmpID"
    ORDER BY a."EmpID";
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/queries006.htm#sthref3175
    From your description, it appears you may need a right outer join. You want to get back all the rows from 'B', not from 'A'. Try a right join and let us know.

  • How to get hardware related metrics of SQL Server through query ?

    Hi Folks,
                   I am newbie to the SQL Server programming. I also follow this forum only now. I am not sure if these kind of question had been asked in the past. Let me furnish you more detail about my query. I do like
    to get few details regarding the SQL server. I do need the following details to get the information about it through query
    SQL Server Installation directory
    No. Of CPU(as i read SQL Server standard support 4 cpu and Enterprise support 32 CPU)
    CPU Speed of the SQL Server installed machine
    Disk Storage details
    Operating system on which the SQL Server is installed
    Location of the swap file of SQL Server
    TempDB directory path
    System database directory path
    User database location 
    Log files location
    I do like to get information like this through query. Can i know if such information can be get through query or it should be get only thro' WMI. Please drop your ideas in getting these details.
    Thanks in Advance,
    Regards,
    JeiSurya

    Try this query in the below link 
    http://gallery.technet.microsoft.com/Query-to-find-all-the-8fa765e6
    you will get the SQL Server and H/W Details like 
    IP Address 
    FQDN 
    CurrentSQLNodeName 
    SQL Instance Name 
    SQL Server Product
    SQL Server Edition 
    Service Pack 
    SQL Server Version 
    Operating System
    OS SP Level
    OS Build Number
    SystemManufacturer 
    Processor Type 
    System Model 
    Total RAM in MB 
    NumberOfPhysicalCPUs 
    NumberOfCoresInEachCPU 
    TotalNumberOfCores 
    NumberOfLogicalCPUs

  • SQL Server 2012/2014 DBA

    Hi, I have been working as system engineer for almost seven years. My primary focus is on Windows Server 2008 R2/2012 R2 technologies, Exchange Server 2010/2013, PowerShell (v2, v3 and v4), SCCM/SCOM 2012 R2, MDT 2012 U1/2013, IIS 8/8.5 and list goes on
    with no MS technologies like Symantec (AV, backup products) and vSphere 5/5.5 since I am big fan of most of these technologies (honestly I am not thrilled working with Exchange Server - too much things under the hood just to send an email :-)). I
    have recently decided to also dig deep into SQL Server 2012/2014 although in my company we do not have anyone whose job is primarily working as SQL DBA. Knowing that SQL Server 2012/2014 has SSRS, SSIS and SSAS beside the main
    one Database Engine, I would like to find out whether SQL DBA has to know very well these three SQL components or he/she should be focused on administering SQL Server databases and querying SQL server (in case of SQL Server
    2012 areas covered by exams 70-462 and 70-461). Having deep knowledge of all these SQL Server services seems like mission impossible and honestly I do not think anyone could master SQL Server "as whole" - unless, maybe, that person is working only
    and I repeat only with SQL Server. It looks like SC 2012 R2 suite - mastering all products in this suite is impossible. So what should I do?

    SSIS was mentioned as very powerful tool in DBA arsenal for automating many administrative tasks without too much difficulties. Since I have no experience in working with SSIS how tough is it for learning and mastering and what books/videos do you
    recommend?
    SSIS is a must for a DBA. In case you have questions, there is an excellent SSIS forum:
    https://social.msdn.microsoft.com/Forums/sqlserver/en-US/home?forum=sqlintegrationservices
    Kalman Toth Database & OLAP Architect
    SQL Server 2014 Database Design
    New Book / Kindle: Beginner Database Design & SQL Programming Using Microsoft SQL Server 2014

  • Error while executing bts_ConfigureBizTalkLogShipping with SQL Server 2012 and BTS 2013

    Hi,
    while configuring the DR site for Log shipping (http://msdn.microsoft.com/en-us/library/aa560961(v=bts.10).aspx)
    exec bts_ConfigureBizTalkLogShipping @nvcDescription = '<MyLogShippingSolution>',
    @nvcMgmtDatabaseName = '<BizTalkServerManagementDatabaseName>',
    @nvcMgmtServerName = '<BizTalkServerManagementDatabaseServer>',
    @SourceServerName = null, -- null indicates that this destination server restores all databases
    @fLinkServers = 1 -- 1 automatically links the server to the management database
    Getting errors while trying to execute the stored procedure "bts_ConfigureBizTalkLogShipping".
    OLE DB provider "SQLNCLI11" for linked server "(null)" returned message "Login timeout expired".
    OLE DB provider "SQLNCLI11" for linked server "(null)" returned message "A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible.
    Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.".
    Msg -1, Level 16, State 1, Line 0
    SQL Server Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF].
    This is very strange because with the same server name (which I am passing in above query) I am able to connect from SQL Server Studio from DR site.
    Any help would be much appreciated.
    Thanks!
    Regards,
    Gautam
    Thanks! Regards, Gautam

    You need to check the DTC Connectivity between your DC and DR SQL Instance. The Linked Server requires DTC connectivity. Secondly this activity is better done from the SQL Server in question (the DC server in your case).
    You can also manually add the Linked Server. Refer
    http://msdn.microsoft.com/en-IN/library/ms188279(v=sql.105).aspx - Linking Servers and
    http://msdn.microsoft.com/en-IN/library/ff772782(v=sql.105).aspx - Creating Linked Servers.
    After having created the Linked Server(s) you can run the log shipping configuration again BUT using @fLinkServers = 0.
    Regards.

Maybe you are looking for

  • Error in Creating Level2 WBS using BAPI_PROJECT_MAINTAIN

    Hi All, I am trying to Create a WBS-element at Level 2 of an already existing WBS-element using BAPI_PROJECT_MAINTAIN. I suppose the 'hierarchy table' has to be populated for positioning a WBS in the structure. But I am getting the error 'The transfe

  • Downgrade Rights 8.1 Pro to 7

    Hello All, I have been searching for a bit but haven't found exactly what I am after, so I thought I'd ask around and see if anybody can help me out. We recently brought 10 machines  (E550) into our environment (20 more on the way) with 8.1 Pro insta

  • Not Burning all Songs

    I'm making a couple of CDs with the same songs on them and when I burn the CD all seems good. They all show up in iTunes as being on the CD. But when I get in my car, only four of the 16 songs play. I tried a differant CD player and only four played

  • How to install j2ee 1.4 sdk , and only that nothing else

    hi guys , i am trying to install j2ee 1.4 sdk. i found the link for it on sun "http://java.sun.com/j2se/1.4.2/download.html ", and when i try to install that package . it has everything from app sever ,to java 2 sdk std edition to start up . etc . bu

  • Help documentation missing out images : localised versions

    Hope a Adobe staff member can get this issue resolved: ISSUE: The localized versions of the PSE11 help missing out the images/illustrations pointed out in the text of the help document. http://helpx.adobe.com/photoshop-elements/using/tools.html compa