Showing posts with label SQLServer. Show all posts
Showing posts with label SQLServer. Show all posts

Wednesday, July 21, 2010

SQL Server 2008 for the Oracle DBA

For those who have lived long enough working Oracle, and if you wish to learn SQL server 2008 by mapping feature set to Oracle database, then this is the video for you.

http://technet.microsoft.com/en-us/sqlserver/dd548020.aspx

Quick Summary from the link:
This 15 modules, level 300 course provides students with the knowledge and skills to capitalize on their skills and experience as an Oracle DBA to manage a Microsoft SQL Server 2008 system. This workshop provides a quick start for the Oracle DBA to map, compare, and contrast the realm of Oracle database management to SQL Server database management.

Thursday, April 8, 2010

Reading data from SQL Server from MS Access

Wow ! I have the way to pull data from SQL server .. sitting in the MS Access application. Thanks to the ODBC linking views available.

Wednesday, April 7, 2010

Hierarchical queries (or recursive queries) in SQL Server 2005/2008

The question is ... how do you run hierarchical queries in SQL server ? I was trying to find something similar to CONNECT BY..PRIOR clause in Oracle. We stepped in to CTE (Common Table Expression). Awesome feature !

* Table has two columns... emp_id, mgr_id (LEVEL in the query is a computed column)

WITH DirectReports (MGR_ID, EMP_ID, Level)
AS
(
-- Anchor member definition
    SELECT mgr_id, emp_id, 0 AS Level
FROM test_emp_mgr    
    WHERE mgr_id is null


    UNION ALL
-- Recursive member definition
    SELECT e.mgr_id, e.emp_id,Level + 1
    FROM test_emp_mgr AS e
    
    INNER JOIN DirectReports AS d
        ON e.mgr_id = d.emp_id
)
-- Statement that executes the CTE
SELECT *
FROM DirectReports;