Archives: February 2013
The INSERT command has two distinct ways to load data into a table.
INSERT INTO Table (field1, field2) VALUES ('string1','string2')
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
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
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
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
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
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