Chapter 12. Stored Procedures
Ah, the good stuff. If you're a programmer coming from a procedural language, then this is probably the part you've been waiting for. It's time to get down to the main variety of code of SQL Server, but before we get going too far down that road, I need to prepare you for what lies ahead. There's probably a lot less than you're expecting and, at the very same time, a whole lot more. The good news is that, with SQL Server 2008, you have .NET support—giving us a veritable "oo la la!" of possibilities.
You see, a stored procedure, sometimes referred to as a sproc (which I usually say as one word, but I've sometimes heard pronounced as "ess-proc"), is really just something of a script—or more correctly speaking, a batch—that is stored in the database rather than in a separate file. Now this comparison is not an exact one by any means—sprocs have things, such as input parameters, output parameters, and return values, that a script doesn't really have, but the comparison is not that far off either.
For now, SQL Server's only "programming" language continues to be T-SQL, and that leaves us miles short of the kind of procedural horsepower that you expect when you think of a true programming language. However, T-SQL blows C, C++, Visual Basic, Java, Delphi, or whatever away when it comes to what T-SQL is supposed to do—work on data definition, manipulation, and access. But T-SQL's horsepower stops right about there—at data access and management. In short, it has ...
Get Beginning Microsoft® SQL Server® 2008 Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.