x002548's Blog

Not Just a Number - Brett Kaiser
posts - 89, comments - 586, trackbacks - 39

June 2004 Blog Posts

A "Non IDENTITY" IDENTITY Column

2 things, 1st, it's not the margartias and 2nd, anything that reads SOX sucks...I gotta read...   Here's the post by Derrick Leggit (to quit?) http://www.sqlteam.com/forums/pop_profile.asp?mode=display&id=5635 And his article http://weblogs.sqlteam.com/derrickl/archive/2004/06/28/1682.aspx   OK:  and the code that always seems to be asked for.  And since rembereing things ain't a strong suite (would tyhat be clubs?)   An old trick in non identity RDBMS's (note: back then we didn't have the niceties of triggers to make sure the identity control table didn't get out of whack)   USE NorthwindGO CREATE TABLE myTable99(Col1 int PRIMARY KEY, Col2 char(1), Col3ect int)GO CREATE TABLE myTable99NextID(NextId int, InUseIND int)GO -- Set the seed INSERT INTO myTable99NextID(NextID, InUseIND) SELECT 0,0GO CREATE TRIGGER myTrigger99NextID...

posted @ Tuesday, June 29, 2004 1:55 PM | Feedback (0) | Filed Under [ SQL Server ]

SQL SERVER TOP 10

The Top 10 questions asked (and answered) at SQL Team.  ALL helpf appreciated, and suggestions on the order of importance...   10.  Where the Hell is Rob 9. Where is Part 2 of More Trees and Hierarchy 8. Why is Graz in a Nun's outfit 7. They have DBAs in Australia? 6. Backup, what's a backup 5. Why is my Tansaction log 30 GB? 4. How do I put the results of dynamic SQL into a variable 3. How do I make An IN statement work with a comma delimeted string 2. How do I search an entire database for a string 1. Where can I find a margarita   OK, there are a...

posted @ Friday, June 18, 2004 11:30 AM | Feedback (2) | Filed Under [ SQL Server ]

Thanks

I just had to post this... http://www.dbforums.com/t1001863.html And as far as Thanks Go,  It's to SQLTeam... Best G-damn site on the planet Rob, Nigel, Damain, Arthur, Bill, Tara...Damn the list is too long..... Thank you everyone! I need a new Yak Tshirt...my son confiscated my old one... Could you imagine if SQLTeam was a consulting group?    

posted @ Friday, June 18, 2004 9:23 AM | Feedback (0) | Filed Under [ Disconnected Ramblings ]

Export out entire database

For some reason this seems to be the season for people needing to dump a database to text....   Well Here's one way...should rewrite it to use INFORMATION_SCHEMA, but it works well enough.. If exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[isp_bcp_out_database]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)drop procedure [dbo].[isp_bcp_out_database]GO CREATE PROC isp_bcp_out_database   @dbName sysname , @fp varchar(255) , @User varchar(255) , @Pwd varchar(255)AS/*  EXEC isp_bcp_out_database    'Northwind'  , 'd:\Data\Northwind\'  , 'sa'  , '' */ SET NOCOUNT ON DECLARE bcpout CURSOR FOR SELECT  -- 'EXEC Master..xp_cmdshell ' +--    '"D:\MSSQL7\Binn\bcp.exe ' + db_Name() + '.[' + TABLE_SCHEMA + '].[' + TABLE_NAME+'] '    'bcp ' + db_Name() + '.[' + TABLE_SCHEMA + '].[' + TABLE_NAME+'] '  + 'out...

posted @ Thursday, June 17, 2004 2:16 PM | Feedback (8) | Filed Under [ SQL Server ]

Computed Columns? Worth their Salt?

Well maybe if it was for a margarita...but me,  I prefer Rocks no salt. But it would be an interesting poll to see how often they are used. Me, I've never used them...and in reading BOL, seems like more of a headache than anything else.  Why not just create a function? Anyone? Geez what a lame post....just curious though... FOR: 2 AGAINST: 2    

posted @ Wednesday, June 16, 2004 8:59 AM | Feedback (8) | Filed Under [ SQL Server ]

Surrogate Keys….The Devil’s spawn (OK Not really)

Always seems to spark a very heated debate…So I’d like to make a list of Pros and Cons that I’d like to keep Adding to. All comments appreciated. So I’ll start with the CON’s, mostly because I believe there are a few reasons for a surrogate key, but it is usually WAY overused and also gets dbas/developers in more trouble . EDIT:  Ok a couple of response so far.  I think I'd like to start a Poll (If that's possible).  I'll add another pro for the devolpers in item #4. EDIT: It's been suggested that surrogates are ANSI.  I thought they were...

posted @ Wednesday, June 09, 2004 11:02 AM | Feedback (26) | Filed Under [ SQL Server ]

Powered by:
Powered By Subtext Powered By ASP.NET