GUIDS in the Database
For those of you who don’t know what a GUID is it is a 128 bit value that is “Unique across space and time”. A GUID looks like this: B2658C9D-A76G-4D72-B0E4-B732332408D6. There garanteed uniqueness...
View ArticleSQL Reformater
I just built a quick little SQL reformater that makes your sql a bit more readable. It takes this:select pmtlndet.pmtlndet_amt, glcdty.glcdty_desc from pmtlndetjoin pmtln on pmtln.pmtln_ID =...
View ArticleSQL basic like goto statements
A lot of people do not know is that SQL supports the GOTO command and labels just like good old basic. An example is worth a 3.3337 words: BEGIN TRAN UpdateDetails update...
View ArticleSQL Security Script 2
A while back I posted a script someone shared with me to generate grants on functions and stored procs to a user. I discovered it is pretty crappy and convoluted. I built this instead: select...
View ArticleReturning extra data in a stored proc
Today I was asked how to return an error code from a database along with other data. While I try to sheer away from error codes from the database and do my validation / logic in the business / data...
View ArticleSQL Boolean Queries
The other night at edmug Richard Campbell presented some good SQL Querying Tips & Techniques. A lot of them were about sql 2005 which was nice to see (espeically using Common Table Expressions...
View ArticleSQL comparison
One of the tools I find lacking in the industry is a good sql comparison utility. I have tried some free ones that really seem to not work very well at all. Commercially I have found that red-gate and...
View ArticleSQL permission script
Often for my deployments I need a script that recreates all stored procs and then grants the public role to have access to it. I posted a script that someone else had developed a long time ago but…. it...
View ArticleDatabase Tricks – Effective Records
One common place where people replicate data is in situations where you need data at a specific point in time. A perfect example I saw today was this situation: You can see that the price column is...
View ArticleLoading MS SQL Database With CSV Data
I recently had to load a lot of comma separated data into a file never knew how easy it was to load CSV data into a table. Here is the t-sql: BULK INSERT Address FROM ‘c:\address.csv’ WITH (...
View Article
More Pages to Explore .....