SQL, (Structured Query Language; other database links, SEQUEL.) A relational database management system RDMS Also links to other Database related websites. MySQL, (pronounced "my ess cue el," not "my sequel"), is a Relational Database Management System, (RDMS), which means it stores data in separate tables rather than putting all the data in one big area. This adds flexibility, as well as speed. The SQL part of MySQL stands for "Structured Query Language," which is the most common language used to access databases. The MySQL database server is the most popular open source database in the world. It is extremely fast and easy to customize, due to its architecture. Extensive reuse of code within the software, along with a minimalist approach to producing features with lots of functionality, gives MySQL a claimed unmatched speed, compactness, stability, and ease of deployment. Their unique separation of the core server from the storage engine makes it possible to run with very strict control, or with ultra fast disk access, whichever is more appropriate for the situation.
Trouble Shooting SQL SQL Injection
Click Here For Your Own Business Website. With hundreds Of Free Webmaster Resources. Webmaster resources like no other site on the Internet. Provides webmasters with the tools they need to create fun and valuable business websites from scratch, within minutes. Combined professional quality designs, powerful PHP and MySQL scripts to create the largest and most exclusive turnkey collection for web designers, entrepreneurs and beginners or enthusiast.
SQL Junkies A feature-packed SQL Server Web site communities on the Internet today. Community for developers to come and learn about building solutions using Microsoft SQL Server while being part of a collaborative community of peers.
MySQL Query Analyzer is a free, powerful and simple to use tool for creating QL scripts for MySQL database engine.
Advanced MySQL Database Administration
mysqld, also known as MySQL Server, is the main program that does most of the work in a MySQL installation. MySQL Server manages access to the MySQL data directory that contains databases and tables. The data directory is also the default location for other information such as log files and status files
phpMyAdmin (Web Interface for SQL). A free software tool written in PHP intended to handle the administration of MySQL over the World Wide Web. phpMyAdmin supports a wide range of operations with MySQL. The most frequently used operations are supported by the user interface (managing databases, tables, fields, relations, indexes, users, permissions, etc), while you still have the ability to directly execute any SQL statement.
SQL Zoo Interactive SQL tutorial, learn about: SQL Server, Oracle, MySQL, DB2, Mimer, PostgreSQL, SQLite and Access.
BigDump: Staggered MySQL Dump Importer. Staggered import of large and very large MySQL Dumps (like phpMyAdmin Dumps) even through the web-servers with hard runtime limit and those in safe mode. The script executes only a small part of the huge dump and restarts itself. The next session starts where the last was stopped. This is great for getting those huge SQL files uploaded and installed ready for use with your SQL quires.
MySQLDumper is a backup script for MySQL-Databases, written in PHP and Perl. MySQLDumper uses a proprietary technique to avoid execution interruption. It only reads and saves a certain amount of commands and then calls itself via JavaScript and memorizes how far in the process it was and resumes its action from its last standby. MySQLDumper restores a backup file by using the same process. Unlike other tools splitting and splicing of large files is no longer necessary. MySQLDumper offers to write data directly into a compressed gz-File. The Restore-Script is able to read this file directly without unpacking it. Of course you can use it without compression, however using Gzip saves a sizeable amount of bandwidth.
mysqldump A Database Backup Program. The mysqldump client is a backup program originally written by Igor Romanenko. It can be used to dump a database or a collection of databases for backup or transfer to another SQL server (not necessarily a MySQL server). The dump typically contains SQL statements to create the table, populate it, or both. However, mysqldump can also be used to generate files in CSV, other delimited text, or XML format. The Database Publishing Wizard enables the deployment of SQL Server 2005 databases (both schema and data) into a shared hosting environment on either a SQL Server 2000 or 2005 server. The tool supports two modes of deployment: It generates a single SQL script file which can be used to recreate a database when the only connectivity to a server is through a web-based control panel with a script execution window. It connects to a web service provided by your hoster and directly creates objects on a specified hosted database. The Database Publishing Wizard provide both a graphical and a command-line interface. In addition, it can integrate directly into Visual Studio 2005 or Visual Web Developer 2005
How do I upload large SQL files to MySQL? The solution to my problem is using the MySQL Tools, (GUI, Graphical User Interface), provided by MySQL. Best of all they are all FREE.
mylvmbackup is a tool for quickly creating backups of a MySQL server's data files. To perform a backup, mylvmbackup obtains a read lock on all tables and flushes all server caches to disk, creates a snapshot of the volume containing the MySQL data directory, and unlocks the tables again. The snapshot process takes only a small amount of time. When it is done, the server can continue normal operations, while the actual file backup proceeds. See Lenz Grimmer's blog Random notes about Linux, MySQL and Open Source Also read LanchPad mylvmbackup
Maatkit makes MySQL easier and safer to manage. It provides simple, predictable ways to do things you cannot otherwise do. It would be nice if these features were included with MySQL, but they are not. That's why Maatkit is now shipping by default with many GNU/Linux distributions such as Debian and CentOS. You can use Maatkit to prove replication is working correctly, fix corrupted data, automate repetitive tasks, speed up your servers, and much, much more.
MySQL Backup enables you to backup a consistent image of a MySQL Server's data and associated metadata via a direct connection to the MySQL server. The backup is synchronized between different storage engines and with the binary log (that can be used for point in time recovery). Different techniques are used by different storage engines to provide the best possible backup and restore. The backup image is stored as a file by the MySQL server. Note: MySQL Backup is currently being developed and this page describes the work in progress. Online Backup of MySQL Cluster
MySQL Workbench is a visual database design tool that is developed by MySQL. It is the successor application of the DBDesigner4 project. It is able to display EER Diagrams, (Entity-Relationship Diagrams), that visualize different parts of the catalogue.
Tip/Trick: How to upload a .SQL file to a Hoster and Execute it to Deploy a SQL Database.
PostgreSQL code generator A tiny and easy to use application that generates a native PL/pgSQL script. The script incrementally updates the tables, columns, indexes and constraints in the database to match the RISE model. Once the database model is updated, the views defined in the RISE model are created in the database and possible default data, entered in the model, is inserted.
Planet MySQL :- Planet MySQL - http://www.planetmysql.org/
Planet MySQL
SQL Server Hosting Toolkit The goal of the SQL Server Hosting Toolkit is to enable a great experience around SQL Server in shared hosting environments. The toolkit will eventually consist of a suite of tools and services that hosters can deploy for use by their customers. It will also serve as an incubation vehicle for tools that hosting customers can download and use directly, regardless of whether their hoster has deployed the toolkit. See the Project Roadmap for details on where we're going.
MySQL Installation Using a Source Distribution
The Full-Text Stuff That We Didn't Put In The Manual MySQL Full Text Search in MySQL 5.1: New Features and How To
Text Stopwords The default list of full-text stop words.
MySQLMan is a web based database manager. It allows you to perform common maintenance and administration tasks in Mysql (Mysql is a great mostly-free SQL database server). MySQLMan was based off of phpMyAdmin, but written in Perl. It allows you to do common tasks like: browse/create/drop databases; browse/search/create/drop/alter tables; import/export data; add/remove/alter table; columns; add/remove/alter table keys, etc...
MySQL Forge Resources for the MySQL Community
WAMP (Windows, Apache, MySQL & PHP). With WAMP installed, you can run a web server (and things like WordPress, MediaWiki, and Jinzora) on your Windows PC. Read this How to install WAMP
JLBN Free WAMP Guides & Website Design Templates.
XAMPP is an easy to install Apache distribution containing MySQL, PHP and Perl. XAMPP is really very easy to install and to use - just download, extract and start. From Apache Friends
Toad for MySQL empowers MySQL developers and administrators develop code more efficiently. It also provides utilities to compare, extract and search for objects, manage projects, import/export data and administer the database. Toad for MySQL increases developer productivity and offers access to a solid community of experts and peers for interactive support.
Sphinx (SQL Phrase Index), Free open-source SQL full-text search engine. Provides fast, size-efficient and relevant fulltext search functions to other applications. Sphinx was specially designed to integrate well with SQL databases and scripting languages. Currently built-in data sources support fetching data either via direct connection to MySQL or PostgreSQL, or using XML pipe mechanism. Syphix Free open-source SQL full-text search engine. As we know build in full text search is currently limited only to MyISAM search engine as well as has few other limits. Today Sphinx Search plugin for MySQL was released which now provides fast and easy to use full text search solution for all storage engines. This version also adds a lot of other new features, including boolean search and distributed searching.
e107 is a content management system written in PHP and using the popular open source mySQL database system for content storage. It's completely free and totally customisable, and in constant development.
PhotoPost is written in highly optimized PHP code and uses a lightning fast MySQL database backend. PhotoPost uses either ImageMagick™ or the GD Graphics Library to resize uploaded images and create thumbnails. Chances are, your web host already has either ImageMagick or GD installed on your server, so be sure to check with them if you don't know if you have one or both installed. More Graphics, Graphics file formats Video and Images
phpBB is a high powered, fully scalable, and highly customizable Open Source bulletin board package. phpBB has a user-friendly interface, simple and straightforward administration panel, and helpful FAQ. Based on the powerful PHP server language and your choice of MySQL, MS-SQL, PostgreSQL or Access/ODBC database servers, phpBB is the ideal free community solution for all web sites.
Maatkit Tools for SQL. Makes MySQL easier and safer to manage. It provides simple, predictable ways to do things you cannot otherwise do. It would be nice if these features were included with MySQL, but they are not. That's why Maatkit is now shipping by default with many GNU/Linux distributions such as Debian and CentOS. You can use Maatkit to prove replication is working correctly, fix corrupted data, automate repetitive tasks, speed up your servers, and much, much more. This is the older MySQL Toolkit. This toolkit contains essential command-line utilities for MySQL, such as a table checksum tool and query profiler. It provides missing features such as checking. A set of essential tools for MySQL users, developers and administrators. The project®s goal is to make high-quality command-line tools that follow the UNIX philosophy of doing one thing and doing it well. They are designed for scriptability and ease of processing with standard command-line utilities such as Awk and Sed. slaves for data consistency, with emphasis on quality and scriptability.
Automatic MySQL Backup. Backup multiple MySQL databases with one script. (Now able to backup ALL databases on a server easily. no longer need to specify each database separately). Backup all databases to a single backup file or to a separate directory and file for each database. Automatically compress the backup files to save disk space using either gzip or bzip2 compression. Can backup remote MySQL servers to a central server. Runs automatically using cron or can be run manually. Can e-mail the backup log to any specified e-mail address instead of "root". (Great for hosted websites and databases). Can email the compressed database backup files to the specified email address. Can specify maximum size backup to email. Can be set to run PRE and POST backup commands. Choose which day of the week to run weekly backups.
MySQL Dump Use MySQL Dump to backup your MySQL databases, both structure and data. The script can be run from command prompt only. So, you can use crontab or other system scheduler to fully automate your data backup process. The script browse all databases that you select and write SQL statements for creating tables and inserting data into files (one for each database). As an option the dumps may be compressed into zip archive. Finally output files stored into directory that you selected.
Transfer Data from/to SQL Server, DB2, Sybase, MySQL and other DB's
Database-SQL-RDBMS HOW-TO Document for Linux (PostgreSQL Object Relational Database System)
Toad® for MySQL Freeware - Provides a comprehensive solution for MySQL professionals to create and execute queries, as well as build and manage database objects. You'll benefit from the project manager, the formatting feature, version control integration, the database browser, the security manager and an extensive knowledge base called Knowledge Xpert for MySQL.
Sql-Articles. This site is intended to produce articles related to sql server and its a free resource .All latest developments in the world of SQL Server will be available. Feel free to post your suggestion in the suggestion tab. You can also contribute any kind of Tips relating to SQL Server in the Tips tab. The sole purpose of starting this website is to create a knowledge base and help all the Newbies in SQL
MyAccess is an AddIn for MS Access which allows you to manage MySQL databases from within Access.
UtterAccess Discussion Forum Microsoft® Access, Excel, Word, Outlook®, Visual Basic®, SQL Server®, Office online help discussion forums. And... many more!
Migrating from Microsoft Access to MySQL
MySQL Migrating from Microsoft SQL Server, Access, or another database to MySQL
Migration of Access data to MySQL - Tutorials - Webmaster Stop
Microsoft SQL Server Microsoft Server System
Migrating from Microsoft Access to MySQL
Microsoft SQL Server DBA Survival Guide
MySQL Storages Engines:-MySQL Native Storage Engines MySQL currently offers a number of its own native Storage Engines, including:-
Partner-Developed Storage Engines. MySQL Partners are actively developing Storage Engines that are optimized for specific application domains:-
Community-Developed Storage Engines. MySQL's community of open source developers are also developing Storage Engines that are optimized for specific application domains.:-
Custom Storage Engines. MySQL's Customers are also developing customized in-house Storage Engines to address their specific needs:-
For more information about the MySQL Storage Engine Partner Program, please contact MySQL. MySQL - InnoDB vs MyISAM
MySQL migration: MyISAM to InnoDB Restrictions on InnoDB Tables Warning: Do not convert MySQL system tables in the mysql database from MyISAM to InnoDB tables! This is an unsupported operation. If you do this, MySQL does not restart until you restore the old system tables from a backup or re-generate them with the mysql_install_db script.
MySQL Gotchas from SQL-info.de
Build Your Own Database Driven Website using MySQL (PHP)
Setting up a MySQL Based Website (using Perl)
MySQL Basics -- A Helpful MySQL Tutorial
Complete List Of MySQL Related (PHP) Commands
MySQL Connector/ODBC (also known as MyODBC) allows you to connect to a MySQL database server using the ODBC database API on all Microsoft Windows and most Unix platforms, including through such applications and programming environments such as Microsoft Access, Microsoft Excel, and Borland Delphi.
Microsoft SQL Server Microsoft Server System
Microsoft SQL Server DBA Survival Guide
My Database Support. Oracle, MySQL, SQL Server Database Support.
Scalable BLOB Streaming infrastructure for MySQL will transform MySQL into a scalable media server capable of streaming pictures, films, MP3 files and other binary and text objects (BLOBs) directly in and out of the database. On this site you will find all information relating to the ongoing activities of this project. The development is led by PrimeBase Technologies, Prime Base an open source software company. Blob=(Binary Large Object) is a that is store the data as binary. Other types of data used in a databases, for example numbers and strings, which store letters and numbers blobs can be used to store images or other multimedia files because of the binary type used. Note: They may often use more storage than other data types.
Protecting Your PHP/MySQL Queries from SQL Injection SQL injection is a serious concern for webmasters, as an experienced attacker can use this hacking technique to gain access to sensitive data and/or potentially cripple your database. If you haven't secured your applications, I implore you to get yourself familiar with the following method and grind it into your coding routine. One unsafe query can result in a nightmare for you or your client.
SQLServerCentral A Microsoft SQL Server community of DBAs, developers and SQL Server users
Ocelot The Standard SQL DBMS
Apache open-source software and Apache Servers. Mod Rewrite.
PostgreSQL Main Site
PostgreSQL Technical Documentation
Mini SQL: A Lightweight Database Server
SQLite is a small C library that implements a self-contained, embeddable, zero-configuration SQL database engine.
Optimize Your MySQL Databases using cPanel and phpMyAdmin
32 Tips To Speed Up Your MySQL Queries
MySQL Web Seminars. News and events. On demand webinars. Discover more about the Structured Query Language
MySQL Performance Tuning :- Green Computing, Data Centre Efficiency, Virtualization And The Cloud There's been a lot of talk of late about green computing, how data centres are becoming more efficient, virtualization and particularly the idea that cloud computing is some sort of panacea. Yes, that maybe so. But you rarely hear anyone mention inefficient software being taken to task: it's the elephant in the room. Serve Static Drupal Content Faster With Boost And Nginx By Stephen Jayna, 23rd December 2009 How To Speed Up Drupal and/or PHP With XCache By Stephen Jayna, 22nd December 2009 Doubtless most of you do this already, but if you don't you probably should at least consider it: install XCache. If you serve pages from Drupal or moreover with PHP you could, as I have, increase your PHP throughput by 167% for five minutes of effort. How To Reduce table_locks_waited In MySQL/MyISAM By Stephen Jayna, 19th August 2009 The scourge of parallelism and scaling everywhere: locking. Or in MySQL/MyISAM — and to be more precise — table locks. Here's an overview of what to look out for and how one might go about reducing the frequency at which they occur. How To Speed Up MySQL: An Introduction To Optimizing By Stephen Jayna, 3rd August 2009 Although there is nothing groundbreaking in this document consider it a bringing together of techniques for your first foray into optimization. We won't discuss the more esoteric methods of squeezing the very last millisecond out of MySQL. There are a myriad of parameters to tune: here's what you need to get right first.
Everita : MySQL Performance Tuning
dbforums Database Forums Covers most types of Database form Adabas to XML & XSLT and More...
MySQL User Defined Functions. Tutorial on writing your own MySQL User Defines Functions
DB2 Universal Database, IBM, for Linux, UNIX and Windows
Low-Cost Unix Database Differences (1999-08-15)
International Oracle Users Group
ITtoolbox Oracle Knowledge Base
SQL Converter. Makes Databases Easy. Convert Excel to SQL in Minutes. SQL Converter 2 for Excel makes databases easy. Start with your familiar Excel spreadsheet and it will generate a MySQL database. Given any file that Excel can read, SQL Converter for Excel will identify the header row and let you select the best data-type for each column. For most files, you can have a MySQL database within three minutes.
Wikipedia: MySQL (free encyclopedia.)
Device Tools is a comprehensive and free portal, aimed at providing engineers who develop connected devices all the information needed to make their next design a success. Covers MySQL Databases and low level and high level coding.
LAMP is an acronym for a set of free software programs commonly used together to run dynamic Web sites: Linux, the operating system; Apache, the web server; MySQL, the database management system (or database server); Perl, PHP, and/or Python, scripting languages.
Host Library Tutorial is designed to guide you through the initial steps of setting up Apache, MySQL, and PHP on Linux.
LAMP Tutorial: Linux, Apache, MySQL, PHP Introduction.
On LAMP O'Rielly
Linux Apache MySQL PHP Web Sites
Senna is an embeddable fulltext search engine, which you can use in conjunction with various scripting languages and databases. Senna is an inverted index based engine, and combines the best of n-gram indexing and word indexing to achieve fast, precise searches. While senna codebase is rather compact it is scalable enough to handle large amounts of data and queries.
SPARQL (pronounced "SPARkLe"). SPARQL is the query language for the Semantic Web (see Semantic Web use cases). SPARQL queries hide the details of data management, which lowers costs and increases robustness of data integration on the Web. SPARQL Query Language for RDF, SPARQL Protocol for RDF, and SPARQL Query Results XML Format. More XML, Extensible Markup Language
MySQL backup,compress and FTP from WinForms app. From your Windows Forms
application, implement two menu commands a) backup entire MySQL database,
compress it and send it with FTP to a ftp server b) reverse = fetch from FTP
server, uncompress, restore to MySQL
SiteVault functions as an FTP files and MySql backup program that will allow you
to browse your backups and restore them with ease. It will be an excellent FTP
program that will allow you to maintain as many connections as you wish, copy
between FTP servers, edit files remotely. It will do as many transfers as you
need simultaneously. It will also double as an awesome file manager and computer
explorer, it's network browsing being the fastest we've seen so far. It'll help
you keep your sites safe, your backups clean and your business running. The
program is meant for persons or organizations running one or multiple sites or
web developers that need to have their work safe.
SQL Team:- Having the SSMS Tools Pack out in the wild enables me to get much “joy” from different bug reports people send me. And let me tell you, people send me back some seriously weird errors. But the most unexpected error message I’ve seen so far was the OverflowException when calling System.Data.SqlClient.SqlDataReader.GetDecimal(Int32 i). It turns out that SQL Server decimal data type is not mapped to the .Net decimal in it’s whole range. .Net decimal type only maps to SQL Server one in the decimal(29, X) range. That means that if you have a decimal column that has the precision higher than 29 and no matter the scale, you won’t be able to use the native .Net data type. So what to do? Let’s take a look with an example. The comments provide additional info. SQL Code: C# Code: If you’re working with large precision types I’d like to hear how you overcome this problem in .Net. The only way I’ve found to deal with this is to either pass around the raw SqlDecimal data type or its string value. A quick search revealed this Connect item that showed the problem with Linq2SQL. I don’t know why this isn’t fixed yet but I hope it will be soon. If you encounter this problem, vote it up. And here's the result: Simply remove "City" from the SELECT clause and the GROUP BY clause to get the median age for all. There may be more efficient tricks out there, but this is certainly the shortest and simplest technique I am aware of. Here's a handy link that shows all the query operator icons used in graphical SQL Server execution plans. Your mission, if you choose to accept it, is to write a query or batch that displays all of them. :) This tape/disk/database will self-destruct in 5 seconds. Good luck, Jim. This is a release that fixes all known bugs. If you encounter any new ones don’t hesitate to report them. :) The main feature list hasn’t changed. A few improvements have been made though: Save SQL Snippets to HTML and/or print them directly from SSMS. In Window Connection Coloring the server names can now be regular expressions giving you the ability to color multiple servers with the same color. Here’s a blog from David Levy (Blog|Twitter) about the new window connection coloring using regular expression and why is it really useful to him. Thanx for kind words Dave. You can download the new version 1.9 here. Enjoy it! Microsoft makes a pretty good OLE DB Provider for DB2 that you can use for SSIS, DTS, and linked servers under SQL Server. It's sometimes difficult to configure but you can get some good starter settings here. In yet another remarkable but not uncommon blunder on their part, Microsoft's installation package will only install the provider on a server with Enterprise or Developer Edition. Why they do this I don't know, but if you have a Standard Edition SQL Server and want to use this provider, here's a workaround: If you're wondering why I'm posting this: <rant> Sorry MS if you don't agree, but DB2 integration is NOT an Enterprise-only feature, nor one that should cost $30K+ to get. If you really think so, then charge $30K for the provider, don't tease your customers with a freebie. </rant> I added the parenthetical title because no one really cares if they can make their databases better. :) Based on some recent tweets (one and two) and blogs I've been reading/writing, I thought I'd create an example of some excellent but underutilized features in SQL Server: defaults and user-defined types. User-defined types (UDTs) are a way of renaming a standard SQL type and additionally providing a NULL or NOT NULL constraint on that type: This can be used in a table definition like so: It saves some typing, and I get an automatic NULL constraint on the column, which I can override with NOT NULL. (Normally I do the reverse; allowing nulls is not a "constraint") Defaults are a deprecated feature that will be removed from SQL Server at a later date. Why? Because someone hates this: They also hate this: Which allows me to reduce this: to this: Yeah I know, when you add up the default and UDT definitions and bindings, you...still save a decent amount of typing, but not all that much... ...unless you have several hundred tables that use the exact same definition. To rehash from my blog post: With a quick mod to my Tweet: I can really beat this horse to death: And reduce my typing by over 60%. By the way, did you like how the datetime UDT, default definition, and binding all fit in a single 140-character tweet? I sure did! I'll leave it up to you to decide if consistent, reusable data types with shorter names and identical defaults are worthwhile. And in case you're asking, yes, I've had developers argue AGAINST this very sentence. Rules are another non-ANSI feature that SQL Server inherited from Sybase, and Microsoft also feels are A Bad Thing™ that should be deprecated. I don't have a good example right now but I should have one in a future blog soon. In the meantime you can read some of my thoughts in this forum post. I can understand Microsoft wanting to remove Sybase cruft, especially if it's non-ANSI standard, but so far I've not heard of any new features to replace them, such as CREATE DOMAIN, which is ANSI standard and neatly combines types, defaults, and rules into one package. If you feel this is a useful feature to have, and a bad one to lose, please visit Microsoft's Connect site and vote on this item. It shouldn't be that hard for them to implement, since they can just borrow the code from the open-source PostGreSQL project. ;) I recently had to modify tables to add some auditing columns and triggers. Being a Unfortunately by making them not nullable, the ALTER statement has to rewrite all the data pages to insert the default values. This kinda-sorta locked down the table(s) and made the database unresponsive for about, oh, 2 hours or so. (Stooooooooopid multi-million row tables!) It also had the side effect of making months worth of transactions appear as if they were created instantly by the same user. For some odd reason my boss felt neither circumstance was a good idea to deploy to production. Happily the solution to both problems was to make the new columns nullable: And add the constraints afterwards: The problem was turning the original, single statement into the 2 new statements, without doing it by hand. (Did I mention there were a few hundred tables in 8 different databases?) Playing around a bit I discovered that this syntax works perfectly: Wow, that's pretty close to the original! (And it runs instantly since it only requires schema locks on the table) It's still annoying because I have to copy the new column name and paste it at the end of the DEFAULT definition. Normally this is where I break out my 1337 4@X0r skillz and INFORMATION_SCHEMA and generate the SQL I need. Sadly the cruel, cold mistress named CHANGE CONTROL had other plans: we have to build from source and deploy with zero changes to the script. Minor changes are allowed but must be exactly repeatable/reproducible. (And also checked into source control, but that's for another time.) If you've ever played with regular expressions (regex) you'll know that it's not hard to reformat the first statement into the last. If you haven't used regex before, or always get frustrated by them, hopefully this example will convince you to spend more time with them. SQL Server Management Studio has a find/replace feature that can use regex. Here's what I used to get the job done (each regex follows after the "-> "): The Find expression breaks up each line into the following groups, using { and } to denote each: 1. All characters before left square bracket [ -> {.*}
The Replace expression uses backreferences (\1, \2, etc.) to do the following: 1. Rebuild the first 3 captured groups exactly as before -> \1\2\3
Try it out for yourself! You can, of course, do a lot more with regular expressions than this, but it's a good introduction for a relatively common problem. In case you're wondering, the find/replace ran in about 15-20 seconds, and the original 2 hour deployment now takes less than 1 minute. One final note: if you've used regex in Perl or some other language, you'll probably wonder why I'm capturing groups with {} instead of the standard () characters. I wonder that too; my only explanation is Microsoft Enjoy! A couple of months ago I wrote a post about Odd Profiler Results with Entity Framework 4. Thanks to Olaf Tinnemeyer, we now have a simple work-around that he posted to my question on StackOverflow. When using the Visual Studio tools to create the Entity Data Model, it automatically builds the Connection String for you, and one of the default settings is to set the MultipleActiveResultSets option to True. If you change this setting to False, then Profiler will properly report that the query was executed within the application database. Please note that I have not done any load testing to determine what type of performance impact this change might have, so YMMV. But for me, I know it will perform acceptably for our needs, and the greater need in my view is to have accurate Profiler results. I have posted this work-around to the Connect item that I opened. I still believe that this is a bug in SQL Server and hope that Microsoft will address it in a future release. If you share my concern, I encourage you to login and vote this up. This problem is designed to come up with a solution that uses the smallest amount of storage possible for a 1,000 seat restaurant. If you are interested in finding out the largest SQL projects in the world, you should check out this PowerPoint presentation. It’s from Kevin Cox of SQL CAT at Microsoft. SQL Saturday is coming to my hometown, San Diego, on September 18th, 2010. I have submitted my session and hope that it gets approved. Let me know if anyone is attending the event in San Diego. If you aren’t in Southern California, check their site for the location nearest you. A while back I wrote a CLR object to track database growth. The CLR object queries sp_databases for each passed in server and saves the data into a table. By using this CLR object, I can track all of my systems in one location. I blogged about this tool in this article. A few weeks ago, I noticed that my SQL Agent job that runs this CLR object was failing. It was only failing on one of my database servers, so I ran sp_databases on that system to figure out what was going on. I noticed that for one database, the DATABASE_SIZE column was NULL. After doing some digging, I realized that sp_databases has a bug in it for any database that is 2TB in size or greater. Sp_databases is using int data type for the DATABASE_SIZE column. Well that’s not big enough for a 2+TB database! A bigint should have been used instead. For backward compatibility reasons, Microsoft decided to display NULL for this situation rather than an error in SQL Server 2005 and 2008. In SQL Server 2000, it throws an error. I found out that there is no bug fix for this, so I had two options. The first option would be to manually patch sp_databases on each of the servers. The second option would be to patch my CLR object. If I patched my CLR object, I could either create a new stored procedure, perhaps name it sp_databases2, or put the query directly into the C# code. I didn’t like the option of patching sp_databases on potentially hundreds of servers even though I could easily deploy it using a batch file that calls sqlcmd. I don’t like the idea of modifying Microsoft’s code even though it’s a simple bug fix. With the second option of patching my CLR object, I didn’t like the idea of creating a new stored procedure as that adds a dependency to my tool. So I instead decided to patch the CLR object by putting the correct query directly in the code. You can download the new version here. Please reference the old article for how to call it, and especially how to call it for all of your servers. The old article also links to the new version of the code, since I didn’t change functionality. Here’s the query in sp_databases that has a bug: And here’s the bug fix: I regularly move logins between servers. Mostly this is between production and our DR site. I’ve used the code in KB246133 many, many times but it’s pretty limited. I started with that and wrote the script below. Today, let's examine encoding with SQL Server and XML datatype. Last November, I blogged about a weird bug with SQL Server 2005 on a Windows 2008 cluster. We were having issues with Database Mail and other things and learned that it was due to the server names being in lower case. To workaround the issue, we had to follow the steps outlined here as there was no bug fix at the time. I’ve now learned that this bug has been fixed! The fix is included in cumulative update package 9 for SQL Server 2005 service pack 3. Check it out here. I got an email from Mr Celko and he correctly stated that my previous solution was not truly working with sets, so he posted me some solutions and proper sample data. As of today I’m the third Slovenian SQL Server MVP. Thanx to all who nominated me! Let’s see how this year goes and i’m sure it’ll be a blast, but most importantly: See you all at the MVP Summit next year! :)) As a follow-up to my previous post Odd Profiler Results with EF4, I have now logged a SQL Server bug to Microsoft Connect. If you have similar concerns, I encourage you to logon to Connect and vote it up. If you have a solution, I encourage you to reply to my blog, or respond to my still unanswered questions on the ASP.NET Forums or Stack Overflow or Server Fault. I will happily mark your answer as correct (assuming that it is). I came across an interesting post on Microsft SQL Server forum this afternoon. It was a question about Relational algebra and the poster wanted to have an efficient query to solve hos problem. Saw a post the other day on SQLTeam. The OP Asked: "If I supply a Date, How can I get the next available date, that is not a holiday, and is not on the weekend." I came up with this hack...please let me know if anyone has come with a different version Thanks Brett CREATE TABLE Holidays (Holiday_Dt datetime, HoldayName varchar(255)) INSERT INTO Holidays(Holiday_Dt, HoldayName) DECLARE @inp_Dt datetime; SET @inp_Dt = '11/25/2010' SELECT TOP 1 CASE WHEN Holiday_Dt IS NULL THEN inp_Dt ELSE DATEADD(d,n,inp_Dt) END AS Next_Available_Dt DROP TABLE Holidays When I try to rename a node name such as a table or column in Management Studio, I cannot use DELETE key to remove previous characters. However, I can use BACKSPACE key. I attended the Web Camp in Redmond last Friday at the Microsoft Conference Center. It was a really nice setup in the room with rows of tables (plenty of space between them) and long power strips so every attendee could plug-in their laptop. The week before that, I attended SQLSaturday, also at a Microsoft facility, and it had rows of tables setup and plenty of in-floor outlets. Maybe this is just to be expected at Microsoft…it makes sense that of the events that will be held at a Microsoft facility, it is likely that a large portion of the attendees will have laptops with them. I sure wish the Washington State Convention Center, which is the recent and next location for the PASS Community Summit had a setup like this. Sure I know that you can’t fit as many people into a room if you set it up with tables, but there are several attendees who are there with laptops open, taking notes and following along, and it sure would be nice. Maybe there is a way the rooms could be configured with chairs-only rows on one side and tables on the other, if it’s not possible to do all tables. Or find some other way to divide the room into sections. Even if you don’t have a laptop, it is nice to have a table to put your notepad on to take notes. At the very least, I would like to see convention centers have more in-floor outlets so that if you’re not going to give me a table, you at least don’t force me to vie for one of the few seats on the outside aisle near a real wall that does have an outlet in it, and then lay out my power cord in a trip hazard. Make it easier (and safer) for everyone. While at WebCamp, I mentioned my Entity Framework 4 / Profiler conundrum to James Senior (@jsenior) and he asked me to send him an email follow-up which I have done, so hopefully he can find out what is going on with this. It strikes me as really odd that I get correct results in a SQL 2000 instance, but wrong results in a SQL 2008 R2 instance. I wonder what’s different.
SQL Server Blogs - SQLTeam.com
-- create a test table in tempdb with one valid and one invalid decimal mapping column.
CREATE TABLE TestTable
(
[ID] [INT] IDENTITY(1,1) NOT NULL,
[ValidDecVal] [DECIMAL](29, 2) NOT NULL,
[InvalidDecVal] [DECIMAL](30, 30) NOT NULL
)
GO
-- insert some data
INSERT INTO TestTable(ValidDecVal, InvalidDecVal)
-- both values are in correct range
SELECT 123456789012345678901234567.56, 0.123456789012345678901234567890private void GetData()
{
using (SqlConnection conn = new SqlConnection(@"server=TestServer; database=tempdb; Integrated Security=SSPI;"))
{
using (SqlCommand cmd = new SqlCommand("SELECT ID, ValidDecVal, InvalidDecVal FROM TestTable", conn))
{
conn.Open();
SqlDataReader rdr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
rdr.Read();
// get the id
int id = rdr.GetInt32(0);
// get the 29 precision value just fine
decimal validDecimal = rdr.GetDecimal(1);
// this errors out ...
decimal invalidDecimal = rdr.GetDecimal(2);
// so does this ...
decimal invalidDecimal = rdr.GetSqlDecimal(2).Value;
// the only thing to do is to either pass around SqlDecimal class
SqlDecimal invalidDecimalAsSqlDecimal = rdr.GetSqlDecimal(2);
// or to cast it to string
string invalidDecimalAsString = invalidDecimalAsSqlDecimal.ToString();
// ... do something with upper values
Console.WriteLine(invalidDecimalAsSqlDecimal);
Console.WriteLine(invalidDecimalAsString);
}
}
}
create table People
(
Person varchar(1) primary key,
City varchar(10),
Age int
)
go
-- with some sample data:
insert into People
select 'A','Boston',23 union all -- odd #
select 'B','Boston',43 union all
select 'C','Boston',29 union all
select 'D','Chicago',15 union all -- single #
select 'E','NY',12 union all -- even #
select 'F','NY',55 union all
select 'G','NY',57 union all
select 'H','NY',61
go
-- here's our query, showing median age per city:
select city,
AVG(age) as MedianAge
from
(
select City, Person, Age,
ROW_NUMBER() over (partition by City order by Age ASC) as AgeRank,
COUNT(*) over (partition by City) as CityCount
from
People
) x
where
x.AgeRank in (x.CityCount/2+1, (x.CityCount+1)/2)
group by
x.City
go
-- clean it all up
drop table People
city MedianAge
---------- -----------
Boston 29
Chicago 15
NY 56
(3 row(s) affected)
Notes:
CREATE TYPE [USERNAME] AS varchar(64) NULL;
CREATE TABLE [MyTable] [UserCreated] USERNAME;
CREATE DEFAULT [whoami] AS SUSER_SNAME();
EXEC sp_bindefault 'whoami', 'USERNAME';
ALTER TABLE [dbo].[MyTable]
ADD [UserCreated] VARCHAR (64) CONSTRAINT [DF_MyTable_UserCreated] DEFAULT (suser_sname()) NULL,
[UserModified] VARCHAR (64) CONSTRAINT [DF_MyTable_UserModified] DEFAULT (suser_sname()) NULL;
ALTER TABLE [dbo].[MyTable]
ADD [UserCreated] USERNAME,
[UserModified] USERNAME;
ALTER TABLE [dbo].[MyTable]
ADD [DateCreated] DATETIME CONSTRAINT [DF_MyTable_DateCreated] DEFAULT (getdate()) NULL,
[DateModified] DATETIME CONSTRAINT [DF_MyTable_DateModified] DEFAULT (getdate()) NULL,
[UserCreated] VARCHAR (64) CONSTRAINT [DF_MyTable_UserCreated] DEFAULT (suser_sname()) NULL,
[UserModified] VARCHAR (64) CONSTRAINT [DF_MyTable_UserModified] DEFAULT (suser_sname()) NULL;
CREATE TYPE [MYDATE] AS DATETIME;
GO
CREATE DEFAULT [now] AS GETDATE();
GO
EXEC sp_bindefault 'now', 'MYDATE';
ALTER TABLE [dbo].[MyTable]
ADD [DateCreated] MYDATE,
[DateModified] MYDATE,
[UserCreated] USERNAME,
[UserModified] USERNAME;
good fair to middling crazed, insane DBA and wanting to ensure data integrity and good design, I made the columns not nullable, and therefore also had to add defaults for these new columns: ALTER TABLE [dbo].[MyTable]
ADD [DateCreated] DATETIME CONSTRAINT [DF_MyTable_DateCreated] DEFAULT (getdate()) NOT NULL,
[DateModified] DATETIME CONSTRAINT [DF_MyTable_DateModified] DEFAULT (getdate()) NOT NULL,
[UserCreated] VARCHAR (64) CONSTRAINT [DF_MyTable_UserCreated] DEFAULT (suser_sname()) NOT NULL,
[UserModified] VARCHAR (64) CONSTRAINT [DF_MyTable_UserModified] DEFAULT (suser_sname()) NOT NULL;
ALTER TABLE [dbo].[MyTable]
ADD [DateCreated] DATETIME NULL,
[DateModified] DATETIME NULL,
[UserCreated] VARCHAR (64) NULL,
[UserModified] VARCHAR (64) NULL;
ALTER TABLE [dbo].[MyTable]
ADD CONSTRAINT [DF_MyTable_DateCreated] DEFAULT (getdate()) FOR [DateCreated],
CONSTRAINT [DF_MyTable_DateModified] DEFAULT (getdate()) FOR [DateModified],
CONSTRAINT [DF_MyTable_UserCreated] DEFAULT (suser_sname()) FOR [UserCreated],
CONSTRAINT [DF_MyTable_UserModified] DEFAULT (suser_sname()) FOR [UserModified];
ALTER TABLE [dbo].[MyTable]
ADD [DateCreated] DATETIME NULL, CONSTRAINT [DF_MyTable_DateCreated] DEFAULT (getdate()) FOR [DateCreated],
[DateModified] DATETIME NULL, CONSTRAINT [DF_MyTable_DateModified] DEFAULT (getdate()) FOR [DateModified],
[UserCreated] VARCHAR (64) NULL, CONSTRAINT [DF_MyTable_UserCreated] DEFAULT (suser_sname()) FOR [UserCreated],
[UserModified] VARCHAR (64) NULL, CONSTRAINT [DF_MyTable_UserModified] DEFAULT (suser_sname()) FOR [UserModified];
Find-> {.*}{\[.*\]}{.*}{CONSTRAINT}{.*}{NOT NULL}{.*}
Replace-> \1\2\3 NULL, CONSTRAINT\5FOR \2\7
2. All characters between (and including) square brackets -> {\[.*\]}
3. All characters between right square bracket ] and the word CONSTRAINT -> {.*}
4. The word CONSTRAINT -> {CONSTRAINT}
5. All characters between CONSTRAINT and NOT NULL -> {.*}
6. The words NOT NULL -> {NOT NULL}
7. All characters after NOT NULL -> {.*}
2. Add a space and the word NULL -> NULL
3. Add a comma, space, and the word CONSTRAINT -> , CONSTRAINT
4. Rebuild the 5th captured group (all characters between CONSTRAINT and NOT NULL) -> \5
5. Add the FOR keyword and a space -> FOR
6. Add the 2nd captured group, which is the column name and its enclosing brackets -> \2
7. Add the remaining characters captured after NOT NULL -> \7 are idiots hate Unix and Perl people have their own unexplained reasons for using non-standard characters. It's not the first time.
I've come up with a solution that need only 125 bytes of storage. All other solutions covered in Mr Celko's book has at least 1,000 bytes of storage.
Here is my solution, complete with all procedures to assign and release seats, together with views to display current status of each and one seat.
-- Setup sample data
CREATE TABLE dbo.Restaurant
(
Seats BINARY(125) NOT NULL
)
-- Initialize an empty restaurant
INSERT dbo.Restaurant
(
Seats
)
SELECT 0x
GO
-- Create procedure for handling seat assignment
CREATE PROCEDURE dbo.spAssignSeat
(
@Seat SMALLINT
)
AS
DECLARE @Block TINYINT,
@Bit TINYINT
SELECT @Block = SUBSTRING(Seats, 1 + (@Seat - 1) / 8, 1),
@Bit = POWER(2, (@Seat - 1) % 8)
FROM dbo.Restaurant
UPDATE dbo.Restaurant
SET Seats = SUBSTRING(Seats, 1, (@Seat - 1) / 8) + CAST(@Bit | @Block AS BINARY(1)) + SUBSTRING(Seats, 2 + (@Seat - 1) / 8, 124 - (@Seat - 1) / 8)
GO
-- Create procedure for handling seat clearance
CREATE PROCEDURE dbo.spClearSeat
(
@Seat SMALLINT
)
AS
DECLARE @Block TINYINT,
@Bit TINYINT
SELECT @Block = SUBSTRING(Seats, 1 + @Seat / 8, 1),
@Bit = CAST(255 AS TINYINT) ^ POWER(2, (@Seat - 1) % 8)
FROM dbo.Restaurant
UPDATE dbo.Restaurant
SET Seats = SUBSTRING(Seats, 1, (@Seat - 1) / 8) + CAST(@Bit & @Block AS BINARY(1)) + SUBSTRING(Seats, 2 + (@Seat - 1) / 8, 124 - (@Seat - 1) / 8)
GO
-- Create tally view
CREATE VIEW dbo.vwNums
AS
WITH L0 AS(SELECT 1 AS c UNION ALL SELECT 1),
L1 AS(SELECT 1 AS c FROM L0 AS A CROSS JOIN L0 AS B),
L2 AS(SELECT 1 AS c FROM L1 AS A CROSS JOIN L1 AS B),
L3 AS(SELECT 1 AS c FROM L2 AS A CROSS JOIN L2 AS B),
Nums AS(SELECT ROW_NUMBER() OVER(ORDER BY c) - 1 AS Number FROM L3)
SELECT TOP(125)
Number
FROM Nums
ORDER BY Number
GO
-- Create view CurrentSeatings
CREATE VIEW dbo.vwCurrentSeatings
AS
SELECT 8 * v.number + b.number + 1 AS Seat,
SIGN(SUBSTRING(Seats, 1 + v.number, 1) & POWER(2, b.number)) AS Taken
FROM dbo.Restaurant AS s
INNER JOIN dbo.vwNums AS v ON v.Number BETWEEN 0 AND 124
INNER JOIN dbo.vwNums AS b ON b.Number BETWEEN 0 AND 7
GO
-- Create the available seats sequence view
CREATE VIEW dbo.vwAvailableSeats
AS
WITH cteSource(Seat, Taken, grp)
AS (
SELECT Seat,
Taken,
Seat - ROW_NUMBER() OVER (PARTITION BY Taken ORDER BY Seat) AS grp
FROM dbo.vwCurrentSeatings
)
SELECT ROW_NUMBER() OVER (ORDER BY grp) AS Sequence,
MIN(Seat) AS FromSeat,
MAX(Seat) AS ToSeat
FROM cteSource
WHERE Taken = 0
GROUP BY grp
GO
-- Display the wanted result
SELECT Sequence,
FromSeat,
ToSeat
FROM dbo.vwAvailableSeats
ORDER BY Sequence
select
DATABASE_NAME = db_name(s_mf.database_id),
DATABASE_SIZE = convert(int,
case -- more than 2TB(maxint) worth of pages (by 8K each) can not fit an int...
when convert(bigint, sum(s_mf.size)) >= 268435456
then null
else sum(s_mf.size)*8 -- Convert from 8192 byte pages to Kb
end),
REMARKS = convert(varchar(254),null)
from
sys.master_files s_mf
where
s_mf.state = 0 and -- ONLINE
has_dbaccess(db_name(s_mf.database_id)) = 1 -- Only look at databases to which we have access
group by s_mf.database_id
order by 1
select
DATABASE_NAME = db_name(s_mf.database_id),
DATABASE_SIZE = convert(bigint, convert(bigint, sum(s_mf.size))*8),
REMARKS = convert(varchar(254),null)
from sys.master_files s_mf
where
s_mf.state = 0 and
has_dbaccess(db_name(s_mf.database_id)) = 1
group by s_mf.database_id
order by 1
USE [master]
GO
/****** Object: UserDefinedFunction [dbo].[fn_hexadecimal] ****/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[fn_hexadecimal]
(
-- Add the parameters for the function here
@binvalue varbinary(256)
)
RETURNS VARCHAR(256)
AS
BEGIN
DECLARE @charvalue varchar(256)
DECLARE @i int
DECLARE @length int
DECLARE @hexstring char(16)
SELECT @charvalue = '0x'
SELECT @i = 1
SELECT @length = DATALENGTH (@binvalue)
SELECT @hexstring = '0123456789ABCDEF'
WHILE (@i <= @length)
BEGIN
DECLARE @tempint int
DECLARE @firstint int
DECLARE @secondint int
SELECT @tempint = CONVERT(int, SUBSTRING(@binvalue,@i,1))
SELECT @firstint = FLOOR(@tempint/16)
SELECT @secondint = @tempint - (@firstint*16)
SELECT @charvalue = @charvalue +
SUBSTRING(@hexstring, @firstint+1, 1) +
SUBSTRING(@hexstring, @secondint+1, 1)
SELECT @i = @i + 1
END
return @charvalue
END
GO
SET NOCOUNT ON
GO
--use MASTER
GO
PRINT '-----------------------------------------------------------------------------'
PRINT '-- Script created on ' + CAST(GETDATE() AS VARCHAR(100))
PRINT '-----------------------------------------------------------------------------'
PRINT ''
PRINT '-----------------------------------------------------------------------------'
PRINT '-- Create the windows logins'
PRINT '-----------------------------------------------------------------------------'
SELECT 'IF NOT EXISTS (SELECT * FROM master.sys.server_principals WHERE [name] = ''' + [name] + ''')
CREATE LOGIN [' + [name] + '] FROM WINDOWS WITH DEFAULT_DATABASE=[' +
default_database_name + '], DEFAULT_LANGUAGE=[us_english]
GO
'
FROM master.sys.server_principals
where type_desc In ('WINDOWS_GROUP', 'WINDOWS_LOGIN')
AND [name] not like 'BUILTIN%'
and [NAME] not like 'NT AUTHORITY%'
and [name] not like '%\SQLServer%'
GO
PRINT '-----------------------------------------------------------------------------'
PRINT '-- Create the SQL Logins'
PRINT '-----------------------------------------------------------------------------'
select 'IF NOT EXISTS (SELECT * FROM master.sys.sql_logins WHERE [name] = ''' + [name] + ''')
CREATE LOGIN [' + [name] + ']
WITH PASSWORD=' + [master].[dbo].[fn_hexadecimal](password_hash) + ' HASHED,
SID = ' + [master].[dbo].[fn_hexadecimal]([sid]) + ',
DEFAULT_DATABASE=[' + default_database_name + '], DEFAULT_LANGUAGE=[us_english],
CHECK_EXPIRATION=' + CASE WHEN is_expiration_checked = 1 THEN 'ON' ELSE 'OFF' END + ', CHECK_POLICY=OFF
GO
IF EXISTS (SELECT * FROM master.sys.sql_logins WHERE [name] = ''' + [name] + ''')
ALTER LOGIN [' + [name] + ']
WITH CHECK_EXPIRATION=' +
CASE WHEN is_expiration_checked = 1 THEN 'ON' ELSE 'OFF' END + ', CHECK_POLICY=' +
CASE WHEN is_policy_checked = 1 THEN 'ON' ELSE 'OFF' END + '
GO
'
--[name], [sid] , password_hash
from master.sys.sql_logins
where type_desc = 'SQL_LOGIN'
and [name] not in ('sa', 'guest')
PRINT '-----------------------------------------------------------------------------'
PRINT '-- Disable any logins'
PRINT '-----------------------------------------------------------------------------'
SELECT 'ALTER LOGIN [' + [name] + '] DISABLE
GO
'
from master.sys.server_principals
where is_disabled = 1
PRINT '-----------------------------------------------------------------------------'
PRINT '-- Assign groups'
PRINT '-----------------------------------------------------------------------------'
select
'EXEC master..sp_addsrvrolemember @loginame = N''' + l.name + ''', @rolename = N''' + r.name + '''
GO
'
from master.sys.server_role_members rm
join master.sys.server_principals r on r.principal_id = rm.role_principal_id
join master.sys.server_principals l on l.principal_id = rm.member_principal_id
where l.[name] not in ('sa')
AND l.[name] not like 'BUILTIN%'
and l.[NAME] not like 'NT AUTHORITY%'
and l.[name] not like '%\SQLServer%'
DECLARE @Inf XML
SET @Inf = '<?xml version="1.0" encoding="utf-16"?>
<root>
<names>
<name>test</name>
</names>
<names>
<name>test1</name>
</names>
</root>
'
SELECT x.value('name[1]', 'VARCHAR(10)') AS Name
FROM @Inf.nodes('/root/names') AS t(x)
If you try to run the code above, you will get an error message like this
Msg 9402, Level 16, State 1, Line 3
XML parsing: line 1, character 39, unable to switch the encoding
Why is that? If you change the encoding to UTF-8, the code works.
The solution is to know that UTF-16 works like UNICODE, and how do we denote UNICODE strings in SQL Server? Yes, by prefixing the string with N.
So this code works with UTF-16 encoding and you can happily continue to work.
DECLARE @Inf XML
SET @Inf = N'<?xml version="1.0" encoding="utf-16"?>
<root>
<names>
<name>test</name>
</names>
<names>
<name>test1</name>
</names>
</root>
'
SELECT x.value('name[1]', 'VARCHAR(10)') AS Name
FROM @Inf.nodes('/root/names') AS t(x)
Consider this sample data
DECLARE @Sample TABLE
The "trick" is to use the TYPE directive (to deal with entitization), and then use ".value" function to get the correct value out.
So here is the final query.
SELECT i.ID,
;WITH cteSource(ID, Content)
With this information at my hand, I started to investigate what really is needed to get this Relational Division to work properly with two sets; Dividend and Divisor.
Some of you know me well, and know I am not satisfied with just solving the problem. There have to be some tweaks, and I did that too with this solution. Not only is it only touching the Dividend table once and Divisor table once, you can also set if you want a division with no remainder (which means all records in Divisor should match and not a single record more), or allow a division with remainder (which means all the records should match and maybe more records).
Great? Just set 1 for "No remainder" and 0 for "Allow remainder".
Simple as that. So why does it work? Remember your old algebra? "Divide is the same thing as multiply with the inverse number..."
Now for the sample data (courtesy of Mr Celko)
CREATE TABLE dbo.Dividend
(
group_id INTEGER NOT NULL,
item_name VARCHAR(10) NOT NULL,
PRIMARY KEY (
group_id,
item_name
)
)
INSERT INTO dbo.Dividend
(
group_id,
item_name
)
VALUES (1, 'one'),
(1, 'two'),
(1, 'three'),
(1, 'four'),
(2, 'one'),
(2, 'two'),
(2, 'three'),
(3, 'one'),
(3, 'two')
CREATE TABLE dbo.Divisor
(
item_name VARCHAR(10) NOT NULL PRIMARY KEY
)
(
item_name
)
VALUES ('one'),
('two'),
('three')
Now for the 4 solutions posted by Mr Celko
-- Celko 1
SELECT D1.group_id
FROM Dividend AS D1
WHERE D1.item_name IN (SELECT item_name FROM Divisor)
GROUP BY D1.group_id
HAVING COUNT(DISTINCT D1.item_name) = (SELECT COUNT(*) FROM Divisor)
AND COUNT(DISTINCT D1.item_name) = (SELECT COUNT(*) FROM Dividend AS D2 WHERE D2.group_id = D1.group_id)
-- Celko 2
SELECT D1.group_id
FROM Dividend AS D1
WHERE D1.item_name IN (SELECT item_name FROM Divisor)
AND NOT EXISTS (
SELECT *
FROM Dividend AS D2
WHERE D2.group_id = D1.group_id
AND D2.item_name NOT IN (SELECT item_name FROM Divisor)
)
GROUP BY D1.group_id
HAVING COUNT(DISTINCT D1.item_name) = (SELECT COUNT(*) FROM Divisor)
-- Celko 3
SELECT D1.group_id
FROM (
SELECT group_id,
item_name,
COUNT(*) OVER (PARTITION BY group_id) AS cnt
FROM Dividend
) AS D1
WHERE D1.item_name IN (SELECT item_name FROM Divisor)
AND cnt = (SELECT COUNT(*) FROM Divisor)
GROUP BY D1.group_id
HAVING COUNT(D1.cnt) = (SELECT COUNT(*) FROM Divisor)
--Celko 4
;WITH Divisor2
AS (
SELECT group_id,
MIN(CASE WHEN item_name IN (SELECT item_name FROM Divisor) THEN 1 ELSE 0 END) OVER(PARTITION BY group_id) AS single,
SUM(CASE WHEN item_name IN (SELECT item_name FROM Divisor) THEN 1 ELSE 0 END) OVER(PARTITION BY group_id) AS full_basket
FROM Dividend
)
SELECT D.group_id
FROM Dividend AS D,
Divisor2
WHERE D.group_id = Divisor2.group_id
AND Divisor2.single = 1
AND Divisor2.full_basket = (SELECT COUNT(*) FROM Divisor)
GROUP BY D.group_id
You can copy and paste the code to a query window and run them. Investigate the execution plan and compare the 4 of them.
And now to my solution.
-- Peso 1
SELECT group_id
FROM (
SELECT t.group_id,
SUM(CASE WHEN t.item_name = n.item_name THEN 1 ELSE 0 END) AS cnt,
COUNT(*) AS Items
FROM dbo.Dividend AS t
CROSS JOIN dbo.Divisor AS n
GROUP BY t.group_id,
t.item_name
) AS d
GROUP BY group_id
HAVING SUM(cnt) = MIN(Items)
AND MIN(cnt) >= 1 -- 1 means no remainder, 0 means remainder
After some challenging with MVP Adam Machanic, here is another version
-- Peso v2
SELECT t.group_id
FROM (
SELECT group_id,
COUNT(*) AS cnt
FROM dbo.Dividend
GROUP BY group_id
) AS kc
INNER JOIN (
SELECT COUNT(*) AS cnt
FROM dbo.Divisor
) AS nc ON nc.cnt = kc.cnt
INNER JOIN dbo.Dividend AS t ON t.group_id = kc.group_id
INNER JOIN dbo.Divisor AS n ON n.item_name = t.item_name
GROUP BY t.group_id
HAVING COUNT(*) = MIN(nc.cnt)
Here is an algorithm (exact division) which is really fast, but not 100% accurate due to the implementation of CHECKSUM (see http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=70832).
-- Peso 3
SELECT group_id
FROM (
SELECT group_id,
CHECKSUM_AGG(CHECKSUM(item_name)) AS ca1,
CHECKSUM_AGG(CHECKSUM(REVERSE(item_name))) AS ca2
FROM dbo.Dividend
GROUP BY group_id
) AS t
INNER JOIN (
SELECT CHECKSUM_AGG(CHECKSUM(item_name)) AS ca1,
CHECKSUM_AGG(CHECKSUM(REVERSE(item_name))) AS ca2
FROM dbo.Divisor
) AS n ON n.ca1 = t.ca1
AND n.ca2 = t.ca2
Now copy my solutions and compare them to the other 4.
-- Celko 1
Table 'Dividend'. Scan count 3, logical reads 6.
Table 'Divisor'. Scan count 2, logical reads 20.
-- Celko 2
Table 'Divisor'. Scan count 3, logical reads 32.
Table 'Dividend'. Scan count 4, logical reads 8.
-- Celko 3
Table 'Divisor'. Scan count 3, logical reads 10.
Table 'Worktable'. Scan count 3, logical reads 31.
Table 'Dividend'. Scan count 1, logical reads 2.
-- Celko 4
Table 'Dividend'. Scan count 2, logical reads 9.
Table 'Worktable'. Scan count 3, logical reads 31.
Table 'Divisor'. Scan count 1, logical reads 38.
-- Peso 1
Table 'Divisor'. Scan count 1, logical reads 19.
Table 'Dividend'. Scan count 1, logical reads 2.
-- Peso 2
Table 'Divisor'. Scan count 1, logical reads 8.
Table 'Dividend'. Scan count 2, logical reads 4.
-- Peso 3
Table 'Divisor'. Scan count 1, logical reads 2.
Table 'Dividend'. Scan count 1, logical reads 2.
So it seems my solution is cleaner and faster than the previous existing. But the best thing is yet hidden. My solution cares for multi-column division (just expand the CASE and GROUP BY clauses) whereas the previous 4 do not. Well, not easily anyway.
It will involve some replacing for IN with EXISTS, and some string concatenation for the DISTINCT clauses.
//Peso
The problem could be solved with relational division, but there is no such operator in SQL Server. Maybe there will be same day.
For a fully working solution, see http://weblogs.sqlteam.com/peterl/archive/2010/07/02/Proper-Relational-Division-With-Sets.aspx
But for now there is no such operator, so we as developers have to find our own ways.
First prepare and populate some sample data
-- Prepare sample data
DECLARE @Sample TABLE
(
ParentID INT NOT NULL,
Keyword VARCHAR(25) NOT NULL,
UNIQUE (ParentID, Keyword)
)
-- Populate sample data
INSERT @Sample
(
ParentID,
Keyword
)
VALUES (1, 'one'),
(1, 'two'),
(1, 'three'),
(1, 'four'),
(2, 'one'),
(2, 'two'),
(2, 'three'),
(3, 'one'),
(3, 'two')
People had already been active and posted some solutions, of which this common query was present.
SELECT s.ParentID
FROM @Sample AS s
WHERE s.Keyword IN ('one', 'two', 'three')
GROUP BY s.ParentID
HAVING COUNT(DISTINCT s.Keyword) = 3
AND COUNT(DISTINCT s.Keyword) = (SELECT COUNT(*) FROM @Sample AS x WHERE x.ParentID = s.ParentID)
and this type of query
SELECT s.ParentID
FROM @Sample AS s
WHERE s.Keyword IN ('one', 'two', 'three')
AND NOT EXISTS (
SELECT *
FROM @Sample AS x
WHERE x.ParentID = s.ParentID
AND x.Keyword NOT IN ('one', 'two', 'three')
)
GROUP BY s.ParentID
HAVING COUNT(DISTINCT s.Keyword) = 3
And even a XML query!
;WITH AggStr
AS (
SELECT ParentId,
(
SELECT CAST(',' AS VARCHAR(MAX)) + c.Keyword
FROM @Sample AS c
WHERE c.ParentID = p.ParentID
ORDER BY c.Keyword
FOR XML PATH('')
) AS c1
FROM (
SELECT DISTINCT
ParentID
FROM @Sample
) AS p
)
SELECT ParentID
FROM AggStr
WHERE c1 = ',one,three,two'
The good thing is that all three produce the same wanted result but the bad thing is the inefficient execution plans. Then one poster did his homework and read about Mr Celko and translated his algorithm to the current problem, and then the query looked like this
SELECT ParentID
FROM (
SELECT ParentID,
Keyword,
COUNT(*) OVER (PARTITION BY ParentID) AS cnt
FROM @Sample
) AS w
WHERE Keyword IN ('one', 'two', 'three')
AND cnt = 3
GROUP BY ParentID
HAVING COUNT(cnt) = 3
With these queries in mind, I thought about the problem and realized the problem did in fact have a much simpler solution.
The query I came up with is the simplest of them all, and just does one pass of the source table. Yes, only one pass just as the first Celko query for relational division, but without the internal worktable.
This is the query I came up with
-- Peso
SELECT ParentID
FROM @Sample
GROUP BY ParentID
HAVING MIN(CASE WHEN Keyword IN ('one', 'two', 'three') THEN 1 ELSE 0 END) = 1
AND SUM(CASE WHEN Keyword IN ('one', 'two', 'three') THEN 1 ELSE 0 END) = 3
How does the query work? The second aggregation filtering just makes sure all three keywords are present.
But the first aggregation filter? What does it do? To simplify, I just write that it takes care of the modulo part of the relational division. There cannot be a "fractional" part of the relational division, because it means that particular ParentID has more keywords than wanted.
Simple as that.
//Peso
PS. These are the textual execution plans for the four types of queries and then mine.
|--Filter(WHERE:([Expr1003]=CASE WHEN [Expr1007] IS NULL THEN (0) ELSE [Expr1007] END))
|--Nested Loops(Left Outer Join, OUTER REFERENCES:([s].[ParentID]))
|--Filter(WHERE:([Expr1003]=(3)))
| |--Compute Scalar(DEFINE:([Expr1003]=CONVERT_IMPLICIT(int,[Expr1014],0)))
| |--Stream Aggregate(GROUP BY:([s].[ParentID]) DEFINE:([Expr1014]=Count(*)))
| |--Index Scan(OBJECT:(@Sample AS [s]), WHERE:(@Sample.[Keyword] as [s].[Keyword]='one' OR @Sample.[Keyword] as [s].[Keyword]='three' OR @Sample.[Keyword] as [s].[Keyword]='two') ORDERED FORWARD)
|--Compute Scalar(DEFINE:([Expr1007]=CONVERT_IMPLICIT(int,[Expr1015],0)))
|--Stream Aggregate(DEFINE:([Expr1015]=Count(*)))
|--Index Seek(OBJECT:(@Sample AS [x]), SEEK:([x].[ParentID]=@Sample.[ParentID] as [s].[ParentID]) ORDERED FORWARD)
|--Filter(WHERE:([Expr1007]=(3)))
|--Compute Scalar(DEFINE:([Expr1007]=CONVERT_IMPLICIT(int,[Expr1010],0)))
|--Stream Aggregate(GROUP BY:([s].[ParentID]) DEFINE:([Expr1010]=Count(*)))
|--Nested Loops(Left Anti Semi Join, OUTER REFERENCES:([s].[ParentID]))
|--Index Scan(OBJECT:(@Sample AS [s]), WHERE:(@Sample.[Keyword] as [s].[Keyword]='one' OR @Sample.[Keyword] as [s].[Keyword]='three' OR @Sample.[Keyword] as [s].[Keyword]='two') ORDERED FORWARD)
|--Index Seek(OBJECT:(@Sample AS [x]), SEEK:([x].[ParentID]=@Sample.[ParentID] as [s].[ParentID]), WHERE:(@Sample.[Keyword] as [x].[Keyword]<>'one' AND @Sample.[Keyword] as [x].[Keyword]<>'three' AND @Sample.[Keyword] as [x].[Keyword]<>'two') ORDERED FORWARD)
|--Filter(WHERE:([Expr1008]=N',one,three,two'))
|--Nested Loops(Inner Join, OUTER REFERENCES:([ParentID]))
|--Stream Aggregate(GROUP BY:([ParentID]))
| |--Index Scan(OBJECT:(@sample), ORDERED FORWARD)
|--UDX(([Expr1007], [C].[Keyword]))
|--Compute Scalar(DEFINE:([Expr1007]=CONVERT(varchar(max),',',0)+@sample.[Keyword] as [C].[Keyword]))
|--Index Seek(OBJECT:(@sample AS [C]), SEEK:([C].[ParentID]=[ParentID]) ORDERED FORWARD)
|--Filter(WHERE:([Expr1005]=(3)))
|--Compute Scalar(DEFINE:([Expr1005]=CONVERT_IMPLICIT(int,[Expr1010],0)))
|--Stream Aggregate(GROUP BY:([ParentID]) DEFINE:([Expr1010]=Count(*)))
|--Filter(WHERE:(([Keyword]='one' OR [Keyword]='three' OR [Keyword]='two') AND [Expr1004]=(3)))
|--Nested Loops(Inner Join)
|--Table Spool
| |--Segment
| |--Index Scan(OBJECT:(@Sample), ORDERED FORWARD)
|--Nested Loops(Inner Join, WHERE:((1)))
|--Compute Scalar(DEFINE:([Expr1004]=CONVERT_IMPLICIT(int,[Expr1009],0)))
| |--Stream Aggregate(DEFINE:([Expr1009]=Count(*)))
| |--Table Spool
|--Table Spool
|--Filter(WHERE:([Expr1004]=(1) AND [Expr1005]=(3)))
|--Stream Aggregate(GROUP BY:([ParentID]) DEFINE:([Expr1004]=MIN([Expr1006]), [Expr1005]=SUM([Expr1006])))
|--Compute Scalar(DEFINE:([Expr1006]=CASE WHEN [Keyword]='three' OR [Keyword]='two' OR [Keyword]='one' THEN (1) ELSE (0) END))
|--Index Scan(OBJECT:(@Sample), ORDERED FORWARD)
GO
SELECT '1/1/2010', 'New Years Day' UNION ALL
SELECT '1/18/2010', 'Martin Luther King' UNION ALL
SELECT '2/15/2010', 'President''s Day' UNION ALL
SELECT '5/31/2010', 'Memorial Day' UNION ALL
SELECT '7/5/2010', 'July 4th Holiday' UNION ALL
SELECT '9/6/2010', 'Labor Day' UNION ALL
SELECT '11/25/2010', 'Thanksgiving' UNION ALL
SELECT '11/26/2010', 'Black Friday' UNION ALL
SELECT '12/24/2010', 'Christmas Holiday' UNION ALL
SELECT '12/31/2010', 'New Years Eve'
GO
FROM (SELECT @inp_Dt AS inp_Dt) AS XXX
LEFT JOIN Holidays h
ON h.Holiday_Dt = xxx.inp_Dt
LEFT JOIN (SELECT 1 n UNION SELECT 2 n UNION SELECT 3 n UNION SELECT 4 n UNION
SELECT 5 n UNION SELECT 6 n UNION SELECT 7 n) AS n
ON xxx.inp_Dt < DATEADD(d,n,inp_Dt)
WHERE DATENAME(dw,DATEADD(d,n,inp_Dt)) NOT IN ('Saturday','Sunday')
AND NOT EXISTS (SELECT * FROM Holidays WHERE Holiday_Dt = DATEADD(d,n,inp_Dt))
GO
GO
First, create some sample data like this
And we also need to create a temporary staging table to hold the valid combinations
Now we only have to do the calculations!
Here I am using a special trick to get the unique combination, since the path of records 1>2>3 is the same as 1>3>2, 2>1>3, 2>3>1, 3>1>2 and 3>2>1. See explanation between combination and permutation at Wikipedia here.
To keep track of which records I already have used in the total sum, I simply remove the record id (RowID) from the Hits list.
And, to give the correct answer at the end, I build a XML string with visited RowID's building up the correct sum.
We also need the records grouped so that we can see which group each expense belong to. In same cases, one and the same record may used in multiple groups.
;WITH ctePack(RowID, Expense, Total, Tracker)
AS (
SELECT s.RowID,
s.Expense,
s.Expense AS Total,
(
SELECT '#' + CAST(x.RowID AS VARCHAR(MAX))
FROM @Sample AS x
WHERE x.RowID <> s.RowID
ORDER BY x.RowID
FOR XML PATH('')
) + '#' AS Tracker
FROM @Sample AS s
WHERE s.Expense <= @WantedSum
UNION ALL
SELECT s.RowID,
s.Expense,
p.Total + s.Expense,
REPLACE(p.Tracker, '#' + CAST(s.RowID AS VARCHAR(MAX)) + '#', '#') AS Tracker
FROM @Sample AS s
INNER JOIN ctePack AS p ON p.Tracker LIKE '%#' + CAST(s.RowID AS VARCHAR(MAX)) + '#%'
WHERE p.Total + s.Expense <= @WantedSum
)
SELECT DISTINCT
DENSE_RANK() OVER (ORDER BY Tracker) AS CombID,
RowID,
Expense
FROM ctePack
WHERE Total = @WantedSum
I've never submitted anything to Microsoft Connect. Do you think that this qualifies? It would certainly seem if not a bug, then a severe annoyance if it ever happened in my code.
Please vote here https://connect.microsoft.com/SQLServer/feedback/details/570758/cannot-use-delete-key-in-ssms-and-object-explorer to fix this little, but annoying, issue.
//Peso
mysql_explain_log is part of the standard MySQL distribution. It can be used to feed general MySQL logs back into MySQL and use EXPLAIN on all statements to analyse which indexes have been used and which queries didn't use any index.
dBforums Forum for various database types.
phpMyAdmin is a web based database administration tool specifically for managing MySQL databases
The Windows® Azure™ Platform is an internet-scale cloud computing and services platform hosted in Microsoft data centers. The Windows Azure Platform provides a range of functionality to build applications that span from consumer web to enterprise scenarios and includes a cloud operating system and a set of developer services. Fully interoperable through the support of industry standards and web protocols such as REST and SOAP, you can use the Azure services individually or together, either to build new applications or to extend existing ones. What is the Windows Azure Platform? Windows Azure Platform Training Kit includes a set of technical content including hands-on labs, presentations, and demos that are designed to help you learn how to use the Windows Azure platform including: Windows SQL Azure and .NET Services. Windows Azure Platform Developer Center More Microsoft® Windows 7, Windows 8, Vista. XP, etc.
Embarcadero Developer Network (EDN), the community site for developers where you can access, leverage and contribute valuable information and knowledge at any time. The knowledge, systems, and membership that are EDN exist to enhance the effectiveness of your day-to-day job performance, enrich the career of anyone involved in systems development and management, and extend the breadth and depth of our industry. Includes C++ Builder, Delphi, J Builder, InterBase, Rapid SQL, etc... Using RAD, (Rapid Application Development), C++ environment and framework designed for ultra-fast development of highly-maintainable Windows GUI applications
w3schools Free HTML, XHTML, CSS, JavaScript, XML, ASP, PHP, SQL tutorials with lots of working examples and source code.
Programming Applications (VBA). Using Applications.
Hosting Question you should ask
Back to top ® © ™ are owned by respective authors and websites. There may be a charge for some software.
The Full-Text Stuff That We Didn't Put In The Manual
MySQL Main Site Troubleshooting search
MySQL Operating System Error Codes
MSDN SQL Server Troubleshooting and Support
Problems and Common Errors Server Error Codes and Messages What to Do If MySQL Keeps Crashing
MySQL Bugs report Search for reported MySQL bugs and information on reporting bugs with MySQL SQL Tools Summary
Maatkit Tools for SQL. Makes MySQL easier and safer to manage. It provides simple, predictable ways to do things you cannot otherwise do. It would be nice if these features were included with MySQL, but they are not. That's why Maatkit is now shipping by default with many GNU/Linux distributions such as Debian and CentOS. You can use Maatkit to prove replication is working correctly, fix corrupted data, automate repetitive tasks, speed up your servers, and much, much more. This is the older MySQL Toolkit. This toolkit contains essential command-line utilities for MySQL, such as a table checksum tool and query profiler. It provides missing features such as checking. A set of essential tools for MySQL users, developers and administrators. The project's goal is to make high-quality command-line tools that follow the UNIX philosophy of doing one thing and doing it well. They are designed for scriptability and ease of processing with standard command-line utilities such as Awk and Sed. slaves for data consistency, with emphasis on quality and scriptability.
Troubleshooting Problems with MySQL Programs (devshed)
Text Stopwords The default list of full-text stop words.
Reserved Words Certain words such as SELECT,DELETE, or BIGINT are reserved and require special treatment for use as identifiers such as table and column names. This may also be true for the names of built-in functions. Reserved words are permitted as identifiers if you quote them as described in Section 8.2, Schema Object Names
Sphinx (SQL Phrase Index), Free open-source SQL full-text search engine. Provides fast, size-efficient and relevant fulltext search functions to other applications. Sphinx was specially designed to integrate well with SQL databases and scripting languages. Currently built-in data sources support fetching data either via direct connection to MySQL or PostgreSQL, or using XML pipe mechanism. Syphix Free open-source SQL full-text search engine. As we know build in full text search is currently limited only to MyISAM search engine as well as has few other limits. Today Sphinx Search plugin for MySQL was released which now provides fast and easy to use full text search solution for all storage engines. This version also adds a lot of other new features, including boolean search and distributed searching.
MySQL crashes is FullText search on with some words:-
MySQL crashes is fulltext search on with some words; Continued
Sometimes the database crash with some fulltext searches... And with only some words (combination of words), not all.
Full text searches causing crashes
MySQL constantly crashes while executing the fulltext search query in boolean mode. When the search key contains two words and the first one is shorter then minimal word length for fulltext index and possibly contains an escaped quote like: WHERE MATCH(post.title,pagetext) AGAINST ('+3\" +exhaust' IN BOOLEAN MODE)
SQL quesry crashes DB. Looks fine to me?
Fine-Tuning MySQL Full-Text Search
Server system variables; #sysvar_ft_min_word_len
SQL Error 28 and Error code 30. "MySQL's temporary directory" /tmp that lacks space available. (Not the main drive). Errcode: 30. This may also be t/mp file issue that may result in message like; execute failed: Can't create/write to file '/tmp/#sql_xyx.MYI' (Errcode: 30) Similar type of error may be cause by too many connection. Error 28 in SQL may occur because of duplicate data in the database. SQL databases should be normalized.
More info about SQL Error 28 and how to avoid it
Cleaning up /tmp directory on busy cPanel web hosting servers. MySQL leaves and uses it's temporary files in /tmp, and if there is no space in there, queries will start failing. Uploads from PHP or Perl are placed in there till the upload process is over, they cannot be further placed there because there is no more space left. So far, we have failing MySQL & inability to upload complete PHP files, system administrator hell.
MySQL headaches: Disk Full, Errcode 28
Where MySQL Stores Temporary Files SQL Other problem solvers:-MySQL Crash Recovery
Recover accidentally removed table files from a MySQL Server
Forums. Computing, webmaster, programming Forums
querysniffer is a MySQL query sniffer written with Net::Pcap. It sniffs the network with pcap, extracts queries from mysql packets, and prints them on standard output.
Back to top ® © ™ are owned by respective authors and websites. There may be a charge for some software.
What is SQL Injection? It is a way to inject SQL query/command as an input possibly via web pages. Many web pages take parameters from web user, and make SQL query to the database. With SQL Injection, it is possible for us to send SQL quire that will carry out an undesired result. For example It could be likened to issuing a format *.* in DOS.
| SQL Injection watch a video about it:- | Web Application Security (SQL Injection) |
SQL Injection Walkthrough This article will try to help beginners with grasping the problems facing them while trying to utilize SQL Injection techniques, to successfully utilize them, and to protect themselves from such attacks.
SQL Injection Attacks by Example
SQL Injection Prevention Cheat Sheet This article is focused on providing clear, simple, actionable guidance for preventing SQL Injection flaws in your applications. SQL Injection attacks are unfortunately very common, and this is due to two factors: a) the significant prevalence of SQL Injection vulnerabilities, and b) the attractiveness of the target (i.e., the database typically contains all the interesting/critical data for your application).
SQL Injection Attacks and Some Tips on How to Prevent Them. Discusses various aspects of SQL Injection attacks, what to look for in your code, and how to secure it against SQL Injection attacks.
SQL Injection wiki Everything About SQL Injection
Introducing Bucket: A Minimal Dependency Injection Container for PHP
How to Detect and Prevent a WordPress Spam Injection Attack. Spam Injection software hides spam keyword links in code that is usually encoded with a PHP function that effectively scrambles HTML, to be decoded once safely embedded on your server, database, etc. You won't see these files decoded, but the Google Bot and other bots will when crawling your site! Once the Bots access the code the spam injection software has done it's work, effectively stealing your search index to improve their own pagerank. Also see Blogs
Back to top ® © ™ are owned by respective authors and websites. There may be a charge for some software.
Web Masters. Click Here Now to start making money. A Great opportunity to make some money. Receive 50% by offering your users Ton's of Keywords on A Great Portal websites. Our Affiliate Program Pays you 50% on Level 1 of Every Sale of our Text Link both searchable and static Text Link!
A Computer Portal. Freeware, Shareware. Download software. Computer languages and Programming code. Including PERL Scripts and Java Scripts. Webmaster Tools. Internet Marketing, Website promotion. Hardware Help from BIOS to Windows and UNIX.
® © ™ are owned by respective authors and websites. There may be a charge for some software. Google™ is a trademark of Google Inc, These pages are not endorsed by Google or any other Company