Monday, September 9, 2013

[SQL Server] comparing a column to Todays date

[SQL Server] comparing a column to Todays date


comparing a column to Todays date

Posted: 09 Sep 2013 04:01 AM PDT

how do we compare a column name "LogDATE" to todays date and if its exists we print out a statement saying the record exists. Ideally we would check the max row and check that the max row has todays date and if it does we print out a statement as " record exist no further action"thanks I tried this but it will give me 9/9 and 9/8 i just want 9/9 or just todays date SELECT LogDATEfrom Xlog WHERE LogDATE >= Convert(datetime, Convert(int, GetDate()))

Pivot views

Posted: 08 Sep 2013 11:52 PM PDT

I am currently reading Itzik Ben Gans book about Microsoft Server 2008 TSQL Fundamentals and I have run into another code example I cannot seem to grasp. The following code runs correctly and selects the data how it should:[code] Select empid, SUM(Case when custid = 'a' then qty end) As A, SUM(Case when custid = 'b' then qty end) AS B, SUM(Case when custid = 'c' THEN qty end) AS C, SUM(Case when custid = 'd' THEN qty end) AS DFROM dbo.ordersGROUP BY empid;[/code]I just don't seem to understand how/why this works? Thank you!

Does stored procedure exist?

Posted: 08 Sep 2013 10:17 PM PDT

Hi all!I want to check about a sored procedure does exist before i Create/alter it.How to?When it's about a table, SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '[TABLE_NAME]' just does the trick - there must be something very similar.Best regardsEdvard Korsbæk

[Articles] No More MCM

[Articles] No More MCM


No More MCM

Posted: 08 Sep 2013 11:00 PM PDT

With the discontinuing of the MCM And MCA programs, Steve Jones has a few thoughts. This is the first of a three part series on certifications.

[MS SQL Server] SQL Agent job log in to Windows as?

[MS SQL Server] SQL Agent job log in to Windows as?


SQL Agent job log in to Windows as?

Posted: 09 Sep 2013 01:20 AM PDT

So my employer has an application which scans the Windows event logs for things to alert on. They're working on setting this up to alert when admins log in during off-hours. Well, this weekend it triggered on my log in...I suspect it's an Agent job I have scheduled to run on Sundays @ 1:00am (the time agrees with their report,) but I want to confirm that what I'm thinking is correct.The job has my account as the owner of the accout. When this job fires, is that the account that will be used by Windows? I'm suspecting it is, but I'd like to confirm that.Thanks,Jason

Adding a Node to a cluster SQL Server 2008 R2

Posted: 08 Sep 2013 10:08 PM PDT

Hi All,Just looking for a bit of clarification on the steps i need to take to add a node to a 2-node sql server 2008 cluster.2-node cluster with three instances (instance1 , instance2 & instance3) installedThe steps i was considering are :1. Infrastructure team build new server and add the new node to the failover cluster at a windows level.2. Run the Add node to the failover cluster option and select instance13. Apply Service Pack 2 to instance14. Check instance1 can failover to the new node5. Repeat steps 2,3 & 4 for instance2 and instance3Does that seem like a o.k plan ?Many thanks

[SQL 2012] Sql Query

[SQL 2012] Sql Query


Sql Query

Posted: 08 Sep 2013 10:16 PM PDT

I have the following data.RowId DateStamp prevStatus CurrentStatus1 6/1/2012 null 82 6/2/2012 8 93 6/8/2012 9 84 6/10/2012 8 95 6/12/2012 9 86 6/16/2012 8 97 6/19/2012 9 8Based on the above data I need to calculate the date difference between the status change between 8 to 8,the time diff between two current status 8. Time diff between rowid 1 and 3,3 and 5 ,5 and 7...Can anyone help me with the query?Thanks.

[T-SQL] round down

[T-SQL] round down


round down

Posted: 08 Sep 2013 07:01 AM PDT

Is there a round down function?

Best way to do this kind of group by

Posted: 08 Sep 2013 02:44 PM PDT

What would be the best way to write a sql query where the result set contains a group by where one column is grouped by one set of columns and another column is grouped by another set of columns and still have the two different group by appear on the same row. Lets say there is a table such as follows: [code="sql"]IF OBJECT_ID('tempdb..#a') IS NOT NULL DROP TABLE #aCREATE TABLE #a (Grp_A CHAR(2), Grp_B CHAR(2), Grp_C CHAR(2), Val_A TINYINT, Val_B TINYINT)[/code]Sample Data:[code="sql"]INSERT INTO #a SELECT 'A1', 'B1', 'C1', 1, 1INSERT INTO #a SELECT 'A1', 'B1', 'C2', 1, 1INSERT INTO #a SELECT 'A1', 'B2', 'C3', 1, 1INSERT INTO #a SELECT 'A2', 'B2', 'C4', 1, 1[/code]The desired result set for the above would be:[code="sql"]SELECT A1.Grp_A, A1.Grp_B, A1.Grp_C, SUM(Val_A) AS GrpBy_ABC, A2.GrpBy_AB FROM #a A1 INNER JOIN ( SELECT A.Grp_A, A.Grp_B, SUM(Val_B) AS GrpBy_AB FROM #a A GROUP BY A.Grp_A, A.Grp_B ) AS A2 ON (A1.Grp_A = A2.Grp_A AND A1.Grp_B = A2.Grp_B) GROUP BY A1.Grp_A, A1.Grp_B, A1.Grp_C, A2.GrpBy_AB[/code]While the above query gives me the desired result, it basically involves two scans on the base table which gives me the following concern. For example, if the base table contains a few million rows and if there are around 6 Group by columns, it can be a pretty expensive query cos there would be two huge scans and a join involving 6 columns.Using grouping sets helps me to do one scan on the base table and get the aggregates.[code="sql"]SELECT GROUPING_ID(A1.Grp_A, A1.Grp_B, A1.Grp_C) AS GroupId, A1.Grp_A, A1.Grp_B, A1.Grp_C, SUM(Val_A) AS GrpBy_ABC, SUM(Val_B) AS GrpBy_AB FROM #a A1 GROUP BY GROUPING SETS( (A1.Grp_A, A1.Grp_B, A1.Grp_C), (A1.Grp_A, A1.Grp_B) )[/code]But the output is not in the desired format since the second GROUPING sET information is not returned on the same row but on a new row. And to get the output into desired format, I will have to do a self join the intermediate output obtained by GROUPING SETS which in essence results in two more 2 huge scans and ends up being worse than the above query using self join on the base table.So what can be the best way to approach this query? This would be part of a Load query, so while there is no requirement to have the query run in a few seconds, I would still like to do it in the best way possible.P.S. Do other DBMS or SQL dialects allow for such a query to be written? Basically something like this;SELECT A.Grp_A, A.Grp_B, A.Grp_C, SUM(Val_A GROUP BY A.Grp_A, A.Grp_B, A.Grp_C) AS GrpBy_ABC, SUM(Val_B GROUP BY A.Grp_A, A.Grp_B) AS GrpBy_AB FROM #a AIn essence, there is only one scan and there is no need for a self join.

[SQL server issues] Commented Issue: AdventureWorksDW2008R2 DimDate table has missing dates [13383]

  1. AdventureWorksDW2008R2 DimDate table has missing dates

    sqlserversamples.codeplex.com/workitem/13383 - Cached - Similar
    28 May 2010 ... AdventureWorksDW2008R2 DimDate table has missing dates. description. There
    is a gap in dates between 2008 and 2010 in the AdventureWorksDW2008R2
    DimDate table. ... The attached script will fix the problem. Use the ... Sign in to
    add a comment or to set email notifications ... Item number: 13383.

  2. AdventureWorksDW2008R2 DimDate table has missing dates [13383]

    sqlsample.blogspot.com/.../ Commented%20Issue%3A%20AdventureWorksDW2008R2%20Di... - Cached
    27 Aug 2013 ... Commented Issue: AdventureWorksDW2008R2 DimDate table has missing
    dates [13383]. pavanbarnala wrote Feb 23, 2012 at 10:47 AM.

  3. Sql samples, sql tips: [SQL server issues] Commented Issue ...

    sqlsample.blogspot.com/.../sql-server-issues-commented-issue.html - Cached
    2 Aug 2013 ... Commented Issue: AdventureWorksDW2008R2 DimDate table has missing
    dates [13383]. pavanbarnala wrote Feb 23, 2012 at 10:47 AM.

  4. Sql samples, sql tips: [SQL server issues] Commented Issue ...

    sqlsample.blogspot.com/.../sql-server-issues-commented-issue_12.html - Cached
    12 Aug 2013 ... AdventureWorksDW2008R2 DimDate table has missing dates ... 08/27/09--10:26
    : Commented Issue: Installer: The zipped DB package doesn't

  5. SqlServerSamples Work Item Rss Feed - Kekunda.com

    reputationless7.kekunda.com/chan-5121419/latest.php - Cached
    24 Jul 2013 ... 08/27/09--10:26: Commented Issue: Installer: The zipped DB .... Issue:
    AdventureWorksDW2008R2 DimDate table has missing dates [13383...

[SQL server issues] Created Issue: SQL Server 2008 Developer edition sample database install error [18174]

  1. SQL Server 2008 Developer edition sample database install error

    sqlserversamples.codeplex.com/workitem/18174 - Cached
    2 Jun 2012 ... SQL Server 2008 Developer edition sample database install error. description. I'
    m trying to install Adventureworks sample dB and i get an error.

  2. Issues - Microsoft SQL Server Community & Samples - CodePlex

    sqlserversamples.codeplex.com/workitem/list/basic - Cached
    22 Feb 2013 ... When I try to run this SQL statement: CREATE DATABASE ... SQL Server 2008
    Developer edition sample database install error ... Id #18174 | Release: None |
    Updated: Feb 22 at 1:37 AM by pleasehelpme99 | Created: Jun 2, ...

  3. Updating... - Microsoft SQL Server Community & Samples - CodePlex

    sqlserversamples.codeplex.com/workitem/list/basic?size... - Cached
    SQL Server 2008 Developer edition sample database install error. I'm trying to
    install ... Id #18174 | Release: None | Updated: Feb 22 at 1:37 AM by
    pleasehelpme99 | Created: Jun 2, 2012 at 12:07 AM by pleasehelpme99. 1.
    Voted. Vote ...

  4. Sql samples, sql tips: [SQL server issues] Created Issue: SQL Server ...

    sqlsample.blogspot.com/.../sql-server-issues-created-issue-sql_12.html - Cached
    12 Aug 2013 ... SQL Server 2008 Developer edition sample database install error.
    sqlserversamples.codeplex.com/workitem/18174 - Cached. 2 Jun 2012 .

  5. Sql samples, sql tips: [SQL server issues] Created Issue: SQL Server ...

    sqlsample.blogspot.com/2013/.../sql-server-issues-created-issue-sql.html - Cached
    2 Aug 2013 ... Created Issue: SQL Server 2008 Developer edition sample database install error
    [18174]. An unexpected error has occured.

  6. Jazz Community Site - Login

    https://jazz.net/jazzdocs/index.jsp - Cached
    IBM developerWorks ... bugs; Submit feature enhancements; Interact with the
    developers; Try our product Web interfaces; See how we use our own products.

  7. Rational Quality Manager and Rational Test Lab Manager 2.0 ... - Jazz

    jazz.net/downloads/rational-quality-manager/releases/2.0?p... - Cached
    29 Jul 2009 ... IBM developerWorks ... The lab management capabilities require the Standard
    Edition of Rational ... known issues pertaining to Rational Quality Manager
    Standard Edition. ... [18206] Install of RQM and move to db2 for database leaves
    no ... trying to save test assets on SLES/WAS61/SQl Server 2008 server ...

  8. Guidance Automation Toolkit Forum - MSDN - Microsoft

    social.msdn.microsoft.com/Forums/en-US/home?forum=vsgatk - Cached
    Library · Code samples ... Visual Studio Database Development Tools (Formerly "
    Database Edition ..... Microsoft patterns & practices is pleased to announce the
    latest addition to ... 18174 Views | Created by Grigori Melnik - Saturday, February
    16, 2008 7:37 .... error occurred while establishing a connection to SQL Server.

  9. SilverStream Application Server 3.5.4 Release Notes - Novell

    www.novell.com/documentation/extendas35/docs/relnotes.html - Cached
    Welcome to SilverStream Application Server Version 3.5.4. ... Known issues with
    this release ... For example, to verify the latest install level for package bos.rte.libc
    you would use the following command: ... IBM AIX Developer Kit .... Microsoft SQL
    Server 6.5 with Service Pack 4 or later, Microsoft ODBC driver for SQL Server ...

  10. Multiple BSODs, help please? - Windows 7 - Bleeping Computer

    www.bleepingcomputer.com/forums/t/.../multiple-bsods-help-please/ - Cached
    I uninstalled Avast and installed Microsoft Security instead as I've seen that ... I
    will certainly look harder if that appears to be the issue though. ... Full Path : C:\
    Windows\Minidump\073113-18174-02.dmp .... Example file hosting sites : .....
    Microsoft SQL Server 2005 Compact Edition [ENU] (Version: 3.1.0000)

  11. Toolbox for IT - Search Results for 'windows 7 assertion pframe failed'

    it.toolbox.com/home/search.aspx?page=132&r...7...1 - Cached
    SQL Server 2008 R2 Developer Edition, installation never completes ... startx
    xauth: creating new authority file /root/.serverauth.18174 X Window System
    Version 7.1.1 Release Date: 12 May ... Hello, I am trying to connect BW to an
    Microsoft SQL Server database. ... Issues while installing Microstrategy Web
    Universal on AIX.

  12. SqlServerSamples Work Item Rss Feed - Kekunda.com

    reputationless7.kekunda.com/chan-5121419/latest.php - Cached
    24 Jul 2013 ... 06/01/12--17:07: Created Issue: SQL Server 2008 Developer edition sample
    database install error [18174] (chan 5121419). I'm trying to install ...

  13. SQL Server >> Archive Page 84

    www.help-sql.info/archive/27/84.html - Cached
    45868: data processing extensions on sql server express edition ... 61876:
    creating a backup report on the report server prob. ... 29423: setup issue: unable
    to install sql server 2005 express on windows 2003 ... 17561: problem occurs
    when migrating a sql server 2000 database to a sql .... 18174: dynamic ftp
    connection

  14. Release notes 2.2 - dCache

    www.dcache.org/downloads/1.9/release-notes-2.2.shtml - Cached
    org/dcache/services/billing/db/sql/billing.changelog-1.9.13.xml::4.1.7::arossi ...
    Made the log for the domain where billing plots are generated less verbose at ...
    Switched the voms-api to version 2.0.6 fixing the exception problem: .... A typical
    NFSv4 installation requires an LDAP or NIS server for user identity management.

  15. Custom Query ? MacPorts

    https://trac.macports.org/query?status=!closed&desc=1... - Cached
    There's a problem with the encoding of non-ASCII characters (the encoding of ... I'
    m requesting that a cvs version of gnuplot be made available. ..... I installed the
    Java Developers Package, and I was able to install pidgin. ..... Example
    Scenarios: ... from a SQL Injection on Microsoft SQL Server to a full GUI access
    on the DB?

  16. a RESTful Pet Catalog | Java.net

    weblogs.java.net/blog/caroljmcdonald/.../2008/.../a_restful_pet_c.html - Cached
    Posted by caroljmcdonald on August 5, 2008 at 9:03 AM PDT ... Sample Catalog
    application implemented with JAX-WS on the server side and JSF on the client
    side ..... Right-mouse click on the MySQL server database and select ... This is a
    glassfish installation or configuration problem. please ask in the glassfish forum.

  17. 16.3sp1 (16-Jan-08) - Petrosys Technical Support

    www.petrosysguru.com/releases/ReleaseNotes_16_3sp1.htm - Cached
    15 Jan 2008 ... If you are upgrading from version 15 or lower then you will need to .... 17805
    Change windows install to Microsoft MSI installer ... 18345 CRS database file
    being used for site CRS reported in ... 18368 Issues with Multiple Dispatch
    Servers on one Host .... 18174 Creating a mapsheet with no projection.

  18. Read more - t?m kiếm nhanh - SEO web | Chuy?n nghiệp

    timnhanh.thietkewebtl.com/?...Created%20Issue: %20SQL%20Server%202008%20Developer%20edition%20sample%20dat...

  19. Silk Performer - Micro Focus Community

    https://community.microfocus.com/...error...server.../1.aspx
    "Could not create the Java Virtual Machine" error when installing ... "ODBC: 5 -
    ODBC error, 42S01 (2714) : [Microsoft][ODBC SQL Server Driver][SQL ... Are
    there any issues with the OdbcIgnoreError function? .... Can SilkPerformer "
    Component Test Edition", "Lite" or "Developers Workbench" be installed ...... Old
    KB# 18174.

  20. Windows Tech >> Visual Studio >> Archive Page 52

    www.windows-tech.info/archive/4/52.php - Cached
    17854: Upgrade "VS 2005 Pro Trial" to registered version: invalid CD key ...
    17856: Problem while debugging remotely using vs2005, "A firewall may be
    preventing ... 17866: Team Foundation Build installation on singer server
    deployment ... 17874: Visio for enterprise architects freezes on database stencil
    selection

Search This Blog