Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 

SQLStudies

My name is Kenneth Fisher and I am Senior DBA for a large (multi-national) insurance company. I have been working with databases for over 20 years starting with Clarion and Foxpro. I’ve been working with SQL Server for 12 years but have only really started “studying” the subject for the last 3. I don’t have any real "specialities" but I enjoy trouble shooting and teaching. Thus far I’ve earned by MCITP Database Administrator 2008, MCTS Database Administrator 2005, and MCTS Database Developer 2008. I’m currently studying for my MCITP Database Developer 2008 and should start in on the 2012 exams next year. My blog is at www.sqlstudies.com.

Archives: February 2013

Insert multiple values sets into a table in one command

The INSERT command has two distinct ways to load data into a table.

INSERT INTO Table (field1, field2) VALUES ('string1','string2')

And

INSERT INTO Table (field1, field2)
SELECT field1, field2 FROM Table2

Both of these are very handy and have been around as far back as I can remember. Historically you… Read more

4 comments, 522 reads

Posted in SQLStudies on 28 February 2013

DROP and CREATE vs ALTER

When writing a script to change a piece of code, say a stored procedure or view, there are 3 basic options.  I’ll start at the outset by saying I use all 3 and that they each have their pluses and minuses.  I’m not trying to advocate one or another, just… Read more

10 comments, 3,267 reads

Posted in SQLStudies on 25 February 2013

Multiple instances, single query window

Anyone who has been reading my blog for a while should realize that several divisions in my company have been merging together.  This means that there are lots of new tasks and processes to learn.  It also means that I’m finding uses for several features of SQL and SSMS that… Read more

0 comments, 431 reads

Posted in SQLStudies on 18 February 2013

Something to watch out for when using sp_rename on Stored Procedures, Functions and Views

For those who don’t know, the stored procedure sp_rename allows you to change the name of a user-created object. Basically when you use sp_rename it changes the name of an object in the catalog tables. Unfortunately on a stored procedure, function or view this isn’t the only place the name… Read more

3 comments, 1,351 reads

Posted in SQLStudies on 11 February 2013

EXECUTE, not required, but advisable.

The other day one of the developers I work with gave me a script similar to this:

BEGIN TRAN
sp_rename 'tablename.columnname', 'newcolumnname'
COMMIT

He was getting the error:

Msg 102, Level 15, State 1, Line 2
Incorrect syntax near 'tablename.columnname'.

Now most of you probably realize that had he just… Read more

1 comments, 313 reads

Posted in SQLStudies on 6 February 2013

Duplicate rows in a table

I recently got the following email:

“I just keyed in two rows into a table with all identical column values. How do I get rid of just one of them?”

Now even way back when in the dark ages when I started as a database developer I ran into this… Read more

10 comments, 2,644 reads

Posted in SQLStudies on 4 February 2013