Effective T-SQL Solutions

Slides:



Advertisements
Similar presentations
AD User Import From SIMS.NET
Advertisements

Forms Authentication, Users, Roles, Membership Ventsislav Popov Crossroad Ltd.
Week 6: Chapter 6 Agenda Automation of SQL Server tasks using: SQL Server Agent Scheduling Scripting Technologies.
Fundamentals, Design, and Implementation, 9/e Chapter 11 Managing Databases with SQL Server 2000.
Brian Alderman | MCT, CEO / Founder of MicroTechPoint Pete Harris | Microsoft Senior Content Publisher.
Chapter 7 Managing Data Sources. ASP.NET 2.0, Third Edition2.
Chapter 10 Overview  Implement Microsoft Windows Authentication Mode and Mixed Mode  Assign login accounts to database user accounts and roles  Assign.
Esri UC2013. Technical Workshop. Technical Workshop 2013 Esri International User Conference July 8–12, 2013 | San Diego, California Administering Your.
Sql Server Advanced Features MIS 424 Professor Sandvig.
What does SQL Server Management Studio mean? Cortex User Group Meeting Portland – 2012 What does SQL Server Management Studio mean? Cortex User Group Meeting.
Today’s Agenda Chapter 12 Admin Tasks Chapter 13 Automating Admin Tasks.
Overview What is SQL Server? Creating databases Administration Security Backup.
Chapter 8 Hardening Your SQL Server Instance. Hardening  Hardening The process of making your SQL Server Instance more secure  New features Policy based.
Microsoft Windows 2003 Server. Client/Server Environment Many client computers connect to a server.
This presentation will guide you though the initial stages of installation, through to producing your first report Click your mouse to advance the presentation.
Session 5: Working with MySQL iNET Academy Open Source Web Development.
Database Security and Auditing: Protecting Data Integrity and Accessibility Chapter 3 Administration of Users.
Introduction to SQL Server 2000 Security Dave Watts CTO, Fig Leaf Software
Forms Authentication, Users, Roles, Membership Svetlin Nakov Telerik Corporation
Today’s Objectives Chapters 10 and 11 Security in SQL Server –Manage server logins and database users. –Manage server-level, database-level, and application.
MICROSOFT SQL SERVER 2005 SECURITY  Special Purpose Logins and Users  SQL Server 2005 Authentication Modes  Permissions  Roles  Managing Server Logins.
Module 9 Authenticating and Authorizing Users. Module Overview Authenticating Connections to SQL Server Authorizing Logins to Access Databases Authorization.
Module 14 Configuring Security for SQL Server Agent.
October 1-2 Ølensvåg. AppFrame SQL – Security Session Code: SQL-201-Security Speaker(s): Jekaterina Golouchova.
Copyright © 2013 Curt Hill Database Security An Overview with some SQL.
Dr. Mustafa Cem Kasapbaşı Security in ASP.NET. Determining Security Requirements Restricted File Types.
Module 10 Assigning Server and Database Roles. Module Overview Working with Server Roles Working with Fixed Database Roles Creating User-defined Database.
BA372 Stored Procedures and Triggers Lab. What needs to be done to change a customer’s credit limit? Who am I? May I? Do it Log it Display A database.
Module 5: Upgrading to SQL Server 7.0. Overview Planning an Upgrade Preparing to Upgrade Verifying the Upgrade Setting a Compatibility Level.
1 Chapter Overview Performing Configuration Tasks Setting Up Additional Features Performing Maintenance Tasks.
2. SQL Security Objectives –Learn SQL Server 2000 components Contents –Understanding the Authentication Process –Understanding the Authorization Process.
ADAPTING YOUR ETL SOLUTION TO USE SSIS 2012 Presentation by Devin Knight
Permissions Lesson 13. Skills Matrix Security Modes Maintaining data integrity involves creating users, controlling their access and limiting their ability.
Master Data Management & Microsoft Master Data Services Presented By: Jeff Prom Data Architect MCTS - Business Intelligence (2008), Admin (2008), Developer.
Mirek Sztajno SQL Server Security PM
Esri UC 2014 | Technical Workshop | Administering Your Microsoft SQL Server Geodatabase Shannon Shields Chet Dobbins.
Agenda for Class 2/20/2014 Introduce Microsoft’s SQL Server database management system. Use the lab to discuss how to CREATE, DROP and populate (INSERT)
Chapter 13Introduction to Oracle9i: SQL1 Chapter 13 User Creation and Management.
SQL Server 2005 Implementation and Maintenance Chapter 6: Security and SQL Server 2005.
Oracle 11g: SQL Chapter 7 User Creation and Management.
1 Working with MS SQL Server Beginning ASP.NET in C# and VB Chapter 12.
SQL SERVER AUDITING. Jean Joseph DBA/Consultant Contact Info: Blog:
Introduction to SQL Server for Windows Administrators Presented to WiNSUG 02/05/09 Bret Stateham Owner, Net Connex Blogs.netconnex.com.
SQL Server Security The Low Hanging Fruit. Lindsay Clark Database Administrator at American Credit Acceptance
Putting Your Head in the Cloud Working with SQL Azure David Postlethwaite 19/09/2015David Postlethwaite.
Putting Your Head in the Cloud Working with SQL Azure David Postlethwaite 18/06/2016David Postlethwaite.
WELCOME! SQL Server Security. Scott Gleason This is my 9 th Jacksonville SQL Saturday Over ten years DBA experience Director of Database Operations
Administering Your Microsoft SQL Server Geodatabase
SQL Database Management
DBMS Programs MS SQL Server & MySQL
Administrating a Database
SQL Server Agent All the Knobs You Need to Know
Recommended Practices & Fundamentals
Lesson 6: Configuring Servers for Remote Management
Using Microsoft Identity Manger with SharePoint 2016 to fill the User Profile Sync Gap Max Fritz Senior Systems Consultant Now Micro.
Introduction to SQL Server 2000 Security
Power BI Security Best Practices
Common Security Mistakes
Who Has What to Which? (The Permissions Superset)
Unit 7 NT1330 Client-Server Networking II Date: 7/26/2016
Principles of report writing
The Dirty Business of Auditing
SQL Server Security 101 How did you get in here, and
Copyright © 2013 – 2018 by Curt Hill
Chapter 11 Managing Databases with SQL Server 2000
SQL Server Security 101 How did you get in here, and
Administrating a Database
Disaster Recovery Done Dirt Cheap Founder Curnutt Data Solutions
Security - Forms Authentication
We Need To Talk Security
Presentation transcript:

Effective T-SQL Solutions Noah Subrin Technical Lead SRA International

Biography Technical Lead for SRA International Speaker at regional Code Camps and other developer events Author of articles for http://www.sswug.org (SQL Server World Wide User Group) Blog site: http://blogs.federalsystems.net Email me at support@federalsystems.net

Agenda How to Set Compatibility Mode Using T-SQL How to Determine Membership in Windows Groups Using T-SQL Creating a Data Driven Web site using MySQL and VS 2008 Importing a .csv file into SQLExpress using Bulk Insert Creating a Non-Sequential Order Number System

How to Set Compatibility Mode Using T-SQL Scenario – Dev team has restored a .bak file from SQL Server 2000 to SQL Server 2005 Questions about features/functionality and query plan performance How to Set/Determine Compatibility mode level This is a system stored procedure. Configurable at the database level, not at the database server level. Any new databases are created based on the compatibility mode of the model system database Functionality based on compatibility level

Stored Proc Syntax sp_dbcmptlevel [ [ @dbname = ] name ]     [ , [ @new_cmptlevel = ] version ] Display the current level or set a new level Only the database owner, members of the sysadmin fixed server role, and the db_owner fixed database role (if you are changing the current database) can execute this procedure.

Compatibility Values 60 = SQL Server 6.0 65 = SQL Server 6.5

Implications For locking hints in the FROM clause, the WITH keyword is no longer optional Do not have access to SQL Server reserved words like PIVOT/UNPIVOT/REVERT Certain ORDER BY expressions work differently Query plans will be optimized to run under SQL Server 2005 Many other implications, reference BOL

Best Practices Set the target to single user access mode by using ALTER DATABASE SET SINGLE_USER. Change the compatibility level of the database to the new level Put the database in multi user access mode by using ALTER DATABASE SET MULTI_USER.

How to Determine Membership in Windows Groups Using T-SQL Scenario – Dev team has done a SQL Server upgrade from SQL Server 2000 to SQL Server 2005 Server is in a managed environment where only Windows Authentication is permitted How can we tell who is a member of what Windows or Active Directory group?

xp_logininfo System stored procedure In SQL Server 2005, Requires membership in the sysadmin fixed server role, or membership in the public fixed database role in the master database with EXECUTE permission granted.

Xp_logininfo Syntax xp_logininfo [ [ @acctname = ] 'account_name' ] [ , [ @option = ] 'all' | 'members' ]      [ , [ @privilege = ] variable_name OUTPUT]

What type of information is returned? List all  members in built-in Windows groups.  List all members in an Active Directory group. Determine if an active directory user is a member of any Windows groups with access to SQL Server.

Result Sets Account name (Fully qualified Windows account name) Type (user or group) Privilege (SQL Server access – admin,user, or null) Mapped login name Permission path (group membership) Column name Data type Description account name sysname Fully qualified Windows account name. type char(8) Type of Windows account. Valid values are user or group. privilege char(9) Access privilege for SQL Server. Valid values are admin, user, or null. mapped login name For user accounts that have user privilege, mapped login name shows the mapped login name that SQL Server tries to use when logging in with this account by using the mapped rules with the domain name added before it. permission path Group membership that allowed the account access.

Creating a Data Driven Web Site using MySQL and VS 2008 Install MySQL Install some sample data Install MySQL GUI Tools Install MySQL .Net Connector Create a new project in VS2008 Make a connection to a datasource Create a dataset and display the data

Importing a .csv file using Bulk Insert SQL Server 2000 had Import/Export wizard SQL Server Management Studio Express (SSMSE) does not have the ability to do this directly How do we do this in SQL Server 2005? TSQL Bulk Insert Command Test with Excel

Possible Problems May need to create a file share May have to specify UNC Path Also may have to have SQLServer service and SQL Agent run under a service account Give service account permissions to the file share

Creating a Non-Sequential Order Number System Scenario: E-commerce system wishes to use a random number scheme to hide volume from the competition. We do not wish to use an identity column with an int data type that increments order numbers by one Competitor could derive volume by subtracting last order number – first number for a given day

Solution Concept Create a numbers table with a range that will correspond to desired order number range Select a random order number using order by newid() clause Mark value in numbers table as being used (IsUsed = 1)

Closing Remarks Thank you for attending Please send me your feedback on this presentation Please feel free to contact me – support@federalsystems.net