A blog about SQL Server, Books, Movies and life in general
Wednesday, March 14, 2007
How To Get The Database Name For The Current User Process
First up is the fastest method. this will run on SQL Server 200 and 2005
SELECT DB_NAME()
Next up is getting the name by joining the sys.dm_exec_requests dmv and sys.sysdatabases. this runs on SQL Server 2005 only
SELECT s.name
FROM sys.dm_exec_requests d
JOIN sys.sysdatabases s on d.database_id = s.dbid
WHERE session_id = @@SPID
Here is something similar, this also runs only on SQL Server 2005
SELECT name
FROM sys.sysdatabases
WHERE dbid = DB_ID()
And we end with something that runs on both SQL Server 2005 and 2000
SELECT name
FROM master..sysdatabases
WHERE dbid = DB_ID()
But like I said before you should always use DB_NAME()
SQL Server 2005 Performance Dashboard Reports Available For Download
Common performance problems that the dashboard reports may help to resolve include:
- CPU bottlenecks (and what queries are consuming the most CPU)
- IO bottlenecks (and what queries are performing the most IO).
- Index recommendations generated by the query optimizer (missing indexes)
- Blocking
- Latch contention
The information captured in the reports is retrieved from SQL Server's dynamic management views. There is no additional tracing or data capture required, which means the information is always available and this is a very inexpensive means of monitoring your server.
Reporting Services is not required to be installed to use the Performance Dashboard Reports.
Keep in mind that the SQL Server instance being monitored must be running SP2 or later.
So what are you waiting for? dowmload it and read the details here: http://www.microsoft.com/downloads/details.aspx?FamilyId=1D3A4A0D-7E0C-4730-8204-E419218C1EFC&displaylang=en
R.I.P Visual FoxPro
Die, die, die my darling
Dont utter a single word
Die, die, die my darling
Just shut your Foxy eyes (I replaced pretty with Foxy)
So for all you FoxPro lovers, there is a great new site (so there is hope for you ;-)) VFP-Conversion
Think Outside the Fox-Den!
Monday, March 12, 2007
map of the world, based on the frequency of its locations mentioned in books.
We've all seen views of the Earth from space, where the numerous pinpoints of light on the ground combine to yield a speckled map of the world. I wanted to show the Earth viewed from books, where individual mentions of locations in books combine to yield another interpretation of the globe. The intensity of each pixel is proportional to the number of times the location at a given set of coordinates is mentioned across all of the books in Google Books Search.
Here is the link: http://booksearch.blogspot.com/2007/03/earth-viewed-from-books.html
Saturday, March 10, 2007
Wladimir Klitschko Knocks Out Ray Austin In The Second Round
Scribd: The YouTube Of Documents
Scribd lets you publish and discover documents online. It is like a big online library where anyone can upload. We make use of a custom Flash document viewer that lets you display documents right in your Web browser. There are all sorts of other features that make it easy and fun to publish, convert, embed, analyze, and read documents.
Part of the idea behind Scribd is that everyone has a lot of documents sitting around on their computers that only they can read. With Scribd we hope to unlock this information by putting it on the web.
What kinds of documents can I publish on Scribd?
Literally, anything you can put in a Word (.doc), PDF (.pdf), text (.txt), PowerPoint (.ppt), Excel (.xls), Postscript (.ps), or LIT (.lit) file.
So go ahead and check it out: http://www.scribd.com/
Windows Server 2003 Service Pack 2 x64 Edition Release Candidate Available For Download
Windows Server 2003 SP2 can be installed directly on the following operating systems:
Windows Server 2003 Editions (All 32-bit x86)
Windows Server 2003 Itanium-based Editions
Windows Server 2003 x64 Editions
Windows Server 2003 R2 Editions
Windows Server 2003 Storage Server R2 Edition
Windows Server 2003 Compute Cluster Edition
Windows Small Business Server 2003 R2
Windows XP Professional x64 Edition
Download it here: http://www.microsoft.com/downloads/details.aspx?familyid=AC8EDD44-96B3-4D11-9293-12970CD62FED&displaylang=en
Friday, March 09, 2007
how to save a whole heap of money on SQL Server 2000 licenses
An insurance company decides to install the trial version of SQL server 2000 on their production box because they don't want to pay the license. After 6 months they backup all the data, wipe out the hard drive (reimage) and install the trial version again, restore all the databases and are good to go for another 6 months...ROFL
Why not just use developer edition? You are violating the license anyway, it will at least save you the hassle of reinstalling every 6 months...
Link to original article is here http://worsethanfailure.com/Articles/SQL_on_Trial.aspx
Thursday, March 08, 2007
Can you solve Joe Celko's SQL puzzles? Three puzzles. Many answers.
These are the puzzles:
Puzzle 1: FISCAL YEAR TABLES
Answer #1
Puzzle 4: SECURITY BADGES
Answer #1
Answer #2
Puzzle 9: AVAILABLE SEATS
Answer #1
Answer #2
Answer #3
Answer #4
Answer #5
the site has individual links to each puzzle and answer, the link to the puzzles is here: http://www.computerworld.com/action/article.do?command=viewArticleBasic&articleId=9012350&source=NLT_APP&nlid=48
Let me know what you think and if you can come up with better/different answers.
Wednesday, March 07, 2007
Visual Studio 2005 Service Pack 1 Update for Windows Vista Available For Download
Brief Description
The Visual Studio 2005 Service Pack 1 Update for Windows Vista addresses areas of Visual Studio impacted by Windows Vista enhancements.
Overview
If the machine participated in the Visual Studio 2005 Service Pack 1 Update for Windows Vista Beta, please be sure to uninstall the beta first.
During the development of Windows Vista, several key investments were made to vastly improve overall quality, security, and reliability from previous versions of Windows. While we have made tremendous investments in Windows Vista to ensure backwards compatibility, some of the system enhancements, such as User Account Control, changes to the networking stack, and the new graphics model, make Windows Vista behave differently from previous versions of Windows. These investments impact Visual Studio 2005. The Visual Studio 2005 Service Pack 1 Update for Windows Vista addresses areas of Visual Studio impacted by Vista enhancements.
Many of the Windows Vista enhancements are documented at the Windows Vista Development Center.
This download installs the Visual Studio 2005 Service Pack 1 Update for Windows Vista for the following Visual Studio SKUs:
Microsoft Visual Studio 2005 Tools for Office
Microsoft Visual Basic 2005 Express Edition
Microsoft Visual C++ 2005 Express Edition
Microsoft Visual C# 2005 Express Edition
Microsoft Visual J# 2005 Express Edition (English Only)
Microsoft Visual Web Developer 2005 Express Edition
Microsoft Visual Studio 2005 Premier Partner Edition
Microsoft Visual Studio 2005 Professional Edition
Microsoft Visual Studio 2005 Standard Edition
Microsoft Visual Studio 2005 Team Edition for Software Architects
Microsoft Visual Studio 2005 Team Edition for Software Developers
Microsoft Visual Studio 2005 Team Edition for Software Testers
Microsoft Visual Studio 2005 Team Suite
Microsoft Visual Studio 2005 Team Test Load Agent
Microsoft Visual Studio 2005 Team Test Load Controller
Microsoft Visual Studio 2005 Code Profiler
Microsoft Visual Studio 2005 Team Explorer
Tuesday, March 06, 2007
SQL Server 2005 Service Pack 2a?
.NET Rocks Podcast: Paul Randal on SQL Server 2005 Performance and Recovery
"Microsoftee Paul Randal drops by for an engaging talk about his contributions
to the recoverability of SQL Server 2005, which are many (Can you say CHECKDB?).
An old friend of ours, and a fairly new friend of Paul's, busts in on the
conversation and makes a cameo appearance. "
Download the podcast here:http://dotnetrocks.com/default.aspx?showID=220
Monday, March 05, 2007
How To Make A FileGroup Read Only in SQL Server 2005
How to make a filegroup read only in SQL Server 2005? This question popped up today on tek-tips. This is how you do that: First we will create a new database named TestFilegroup. Next we will add a filegroup named Test1FG1 which contains a file named test1dat3.
The next step is to do an alter database modift filegroup readonly command
Here is the complete script
USE master
go
--Create New DB For Testing
CREATE DATABASE TestFilegroup
go
--Create FileGroup
ALTER DATABASE TestFilegroup
ADD FILEGROUP Test1FG1;
--Add file to fileGroup
ALTER DATABASE TestFilegroup
ADD FILE
(
NAME = test1dat3,
FILENAME = 'c:\t1dat3.ndf',
SIZE = 5MB,
MAXSIZE = 100MB,
FILEGROWTH = 5MB
)
TO FILEGROUP Test1FG1
--Make FileGroup ReadOnly
ALTER DATABASE TestFilegroup
MODIFY FILEGROUP Test1FG1 Read_Only;
Use Read_Only not ReadOnly because the keyword READONLY will be removed in a future version of Microsoft SQL Server. Avoid using READONLY in new development work, and plan to modify applications that currently use READONLY. Use READ_ONLY instead.
Now what happens when you try to create a table on filegroup Test1FG1?
USE TestFilegroup
GO
CREATE TABLE abc (id INT) ON Test1FG1
You will see the following error message
Server: Msg 1924, Level 16, State 2, Line 1
Filegroup 'Test1FG1' is read-only.
You can use sys.filegroups and check the is_read_only column to find out if a filegroup is read only
SELECT is_read_only
FROM sys.filegroups
WHERE name = 'Test1FG1'
Here is the result
is_read_only
------------
1
Using NTFS Compression with Read-Only User-defined Filegroups and Read-Only Databases
SQL Server 2005 supports NTFS compression of read-only user-defined filegroups and read-only databases. You should consider compressing read-only data in the following situations:
You have a large volume of static or historical data that must be available for limited read-only access.
You have limited disk space.
ASP.NET Library Site Launched
Applications
Controls
Database
HTML
So go ahead and check it out: http://aspnetlibrary.com/
Sunday, March 04, 2007
Arrays and Lists Article Updated For SQL Server 2005
Friday, March 02, 2007
The Digg Effect
Here is a graph of the pageviews
I promise that I WILL write a SQL post this weekend and it will be about partitioned functions It will show you how you can use $PARTITION to select data from a specific partition
Top 5 Post and Google Searches For Jan and Feb 2007
1 The Sysinternals Troubleshooting Utilities have been rolled up into a single Suite of tools
2 Ten SQL Server Functions That You Hardly Use But Should
3 Clippy Is Not Dead, Clippy Is Alive.....On Linux
4 Increase Your Productivity With Query Analyzer
5 The Real Reason Why Condoleezza Rice Never Smiles
So two of these (Clippy and Condoleezza) have nothing to do with SQL Server.
Top Queries
These are searches that people typed in the Google search box on this site
I always keep track of these because it gives me some ideas of what to write
Here is the top list for the last 2 months, I left out the adult searches ;-)
None
did france pay brazil to win the cup
NotMyFault
query analyzer not view
sql login
saltrain
notmyfault
%disk read time
defrag
daylight saving SQL Express
maximum number database
openrowset
SQL queries
tree structure catalogue
rainbowfish children book
failed for login sa
jacobs
sysinternals
origin of the name jacobs
Top Ten Posts Of All Time
1 The Sysinternals Troubleshooting Utilities have been rolled up into a single Suite of tools
2 SQL Query Optimizations
3 Ten SQL Server Functions That You Hardly Use But Should
4 Five Ways To Return Values From Stored Procedures
5 Login failed for user 'sa'. Reason: Not associated with a trusted SQL Server connection. SQL 2005
6 Clippy Is Not Dead, Clippy Is Alive.....On Linux
7 NULL Trouble In SQL Server Land
8 COALESCE And ISNULL Differences
9 Increase Your Productivity With Query Analyzer
10 Three Ways To Display Two Counts From a Table Side By Side
How Do I? video series focused on SQL Server 2005 Express
So what is in this series?
#1 What is a Database?
(28 minutes, 15 seconds)
#2 Understanding Database Tables and Records
(24 minutes, 56 seconds)
#3 More about Column Data Types and Other Properties
(21 minutes, 37 seconds)
#4 Designing Relational Database Tables
(34 minutes, 10 seconds)
#5 Manipulating Database Data
(40 minutes, 20 seconds)
#6 More Structured Query Language
(23 minutes, 13 seconds)
#7 Understanding Security and Network Connectivity
(40 minutes, 59 seconds)
#8 Connecting your Web Application to SQL Server 2005 Express Edition
(1 hour, 5 minutes)
#9 Using SQL Server Management Studio
(40 minutes, 26 seconds)
#10 Getting Started with Reporting Services
(32 minutes, 51 seconds)
#11 Building and Customizing Reports in Business Intelligence Development Studio
(44 minutes, 50 seconds)
#12 Creating and Using Stored Procedures
(42 minutes, 34 seconds)
#13 Enabling Full-Text Search in your Text Data
(38 minutes, 25 seconds)
You can download all of these here: http://www.asp.net/learn/videos/default.aspx?tabid=63#sql
Enjoy