Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
Some of the simplest functions to begin with are just using the configuration functions. These allow us to get information like the server name and the version and the connections that have occurred since this server was last booted up. If I am going to write an SQL statement to read them, I still need to have a good old SELECT statement here because that's how we fetch information. Well, what I'm interested in is things like the server name. I'm going to do the two @ signs because most of the configuration functions are the ones without parentheses that begin with two @ signs. I use my trusty IntelliSense and I've got quite a few. There is about 30 something to choose from.
Lets take a little look at @ sign. @@SERVERNAME. Now you'll notice that I'm not saying use AdventureWorks because doesn't really matter where I am. This functions is going to execute and return the name of my standalone PC here, which is just SIMON-PC. I could do @@VERSION to find the version of SQL Server that is currently running, which tells me that it's the 2008 R2(RTM) and even the point releases of it. Like any SQL statement that you're executing without an actual official column name, we're getting the No column name result over here.
If I wanted to give that return value a name I could use AS. Let's call it ServerVersion. Execute that and we have a named result here. But using these functions is kind of like specifying any column or list of columns in a SELECT statement. I can type multiple ones in here. The main difference is I don't need a FROM statement. So it's telling me now I've got the version, I've got the server name, and apparently there's been 6847 connections that have been either successful or attempted but unsuccessful against this server since it was last started up.
So experiment with a few of the available configuration functions. Yu can either look at them and Books Online or again drilling down into the individual databases. You can find your System Functions, Configuration section where you'll see a lot of those listed. Some you may not be too bothered about and others you're going to find essential as you move on.
Get unlimited access to all courses for just $25/month.Become a member
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.