Posts

SSAS Tabular

After a brief stint, I will begin posting some bootstrap articles around  Multi Dimensional databases and Tabular.   So if you are working with SSAS, send me your questions via twitter.  And I will post some answers here.  Follow @seecoolguy

Service Broker and External Activator for Sql Server...

I ntroduced in Sql Server 2005, Microsoft's Service Broker is a Messaging Queue for Sql Server.  You can audit tables, trigger events, and even call web services (Using the External Activator). Follow this excellent tutorial by Dev Kimchi which helps you step by step and clearly explain how to setup your Service Broker messaging queue. To get started with the external activator you will require the version for the version of Sql Server you are running, click on any of the Microsoft download links and follow the install instructions: Microsoft® SQL Server® 2012 Feature Pack Microsoft® SQL Server® 2014 Feature Pack One last thing before you get frustrated installing the External Activator service on a remote server.  At least for the 2012 version, it still required .Net 3.5 installed on the destination computer/server.  If you are trying to install on a Windows 2012 server follow this helpful guide on how to get .Net 3.5 installed now that the latest packs have b...

But can you Tuna Fish? Database Optimizations worth reviewing

Image
T here are always new articles about the web that will offer new ways on how to optimize the performance of your database. There are hardware focused optimizations that can and do improve your users data access, and you can fix things at the code level too.  Then there is optimizing your database engine to squeeze out every last bit of performance. Are you just a bit curious on how to get started? A recent blog article targets many areas in your code that you can mitigate to help deliver the best performance, there are also indexing guides which I don't think I've ever covered in my blog, check it out here: https://www.toptal.com/sql/sql-database-tuning-for-developers which covers these topics, Database Optimization (in the Codebase) Indexes Tune SQL query performance by avoiding coding loops Avoid correlated subqueries Select sparingly The use of temp tables SQL Server Performance Tuning: Execution Plans To optimize your existing indexes you can refer to ...

Keeping it Real (short) How to shrink a transaction log file

Image
Space, the final frontier ....  The common wisdom on your Database Files is to NEVER shrink your data files.  Space is cheap,  but it's worth knowing how to shrink the size of your data files especially when you are running out... How to Truncate Log files in Sql Server 2008 If your transaction log files are growing beyond their disk size, it's  important to consider why your log file keeps growing?  Databases Log Files will use space to quickly write to disk the many operations it requires and thus some file growth is expected when you reach beyond the initial sizing of your database.  When you notice continual growth of your transaction log file, you need to start looking at your backup strategy to help manage it.  Did you set your recovery model to the appropriate one?  Should you be performing more transaction log backups? for more information on the shrinkfile operation, consider reviewing the tech doc at Microsoft. You ...

What's up?

I'm coding that's what's up... http://xcodethis.blogspot.com

Lighting Quick Table RowCounts for your Tables

Image
If you are familiar with TSQL and want to get a row count from your tables you might be tempted to run a simple Select count(*) from myTable This however can be a lengthy wait if you have millions and millions of records. Not to mention the potential impact on a production system. Instead consider selecting your rowcounts from your system tables SELECT OBJECT_NAME(id), ROWS, indid FROM sysindexes WHERE indid AND OBJECT_NAME(id) IN ('myTableName') Looking forward beyond Sql Server 2005 and beyond the following select should be used and will provide you with the needed information as system tables access may be depracated SELECT DISTINCT OBJECT_NAME(P.object_id) AS [Name], ROWS FROM sys.indexes I INNER JOIN sys.partitions P ON P.object_id = I.object_id AND P.index_id = I.index_id WHERE I.index_id AND OBJECT_NAME(P.object_id) IN ('myTableName') So why am I searching for index smaller than 2? In short from the article below you'll find that pure data pages have indi...

New Look... New Stuff

Image
Hi everyone... So some new things are going to be happening with my blog... I'm going to pick some helpful hints that help me and my fellow DBA's with what we do on a Daily or weekly basis. These should be helpful for all but you are more than welcomed to share your experiences on what Tips help you the most. One thing that is comming is an article on Wait times... I had the pleasure of trying out Confio's Ignite software. And while it does some really great things, such as pointing out where the bottle necks are for performance on your server. It can be pretty pricey and really does not introduce anything you can't already do. I'm planning on rolling out a short but continuous list of I/O wait times what they are and how to use them to boost performance on your SQL Server within the coming weeks, I will not concentrate on Sql Server 2005/2008 alone, I know that is the trend in the tech community but there are still many organizations that use Sql Server 2000, ...

iPad Wifi Networking Issues

Image
I had recently been reading a lot about the the wifi issues surrounding the iPad, and though this post is not SQL related, it kinda is for me. You see I was using a Remote Desktop app on my iPad when the connection started to drop out on me. Something new that I had started to experience. I determined that it had to do with bluetooth being enabled. I tried disabling it and the iPad returned to it's normal bandwidth loving behavior... the thing was that I was using a bluetooth keyboard with it to type up my sql... so I had to find an alternate solution... Solution one... you can actually just turn up the brightness on your iPad and it will keep the wifi from going into sleep mode.. wierd right? or in my case so I didn't need to fumble around I decided to changes some wifi settings of my TrendNet Router, I found the settings at the macrumors forum, http://forums.macrumors.com/showthread.php?t=889348&page=6 the settings on my wireless that fixed my problem (apparently perm...

New Ranking tutorial

Image
This is kinda cool. I currently do not have a need for it as my job does not require me to write new tsql code on a daily basis anymore. However, when I used to write ranking code it was always a LONG and TEDIOUS process not really because of the Ranking code, but mostly because of what it takes to get to the ranking code. ARG! My Ranking routine believe it or not consisted of a small segment of code with a CURSOR! This is an snippet of code from what I used to use and is actually still in production today declare tstcur CURSOR FOR SELECT id FROM @temp declare @rank as integer declare @tID as integer OPEN tstcur FETCH NEXT FROM tstcur INTO @tID WHILE @@FETCH_STATUS = 0 BEGIN select @rank = count(*)+1 FROM @temp WHERE final_score > (select final_score from @temp where id = @tID) insert into @temp (id, Division, responses, max_points, total_points, final_score, rank) select id, Division, 0, max_points, total_points, final_score, 0 from @temp where id = @tID update @temp set...

Rename a Sql Server Database

Image
Often when a database needs to be renamed a common tool that I've used in the past was always to use the sp_renamedb procedure. And that's one of the reasons I love the internet, there is always a better way to do something. Take the tips on how to rename your database without the use of this procedure. What is neat about the following article is that it also changes the logical and physical names of the database. see more at this link... http://www.mssqltips.com/tip.asp?tip=1891

Boosting Performance

Image
F ixing smallish databases which are less than 1-2 gb may be just annoying when you are dealing with multiple indexes, but try managing some of those larger ERP databases with literally thousands of tables! Talk about a database from hell, having to sift through 10 of thousands of indexes can be a real chore if you're searching for performance bottle necks. There are some great solutions out there that all cost money per instance or per site license and can get quite pricey. But just about all of those products are charging you for something you can do on your own. T he article below is an extension of my previous blog on maintaining those indexes It's the script that has evolved from some very basic loops and DMV ( dm_db_index_physical_stats ). In my script (follow the link below) You'll find that I chose to stick to a SAMPLED stats, which essentially looks at the number of compressed pages. If you're talking millions of row of data and a very short maintenance w...

UTO! Unidentified Table Object

Image
It's been a while since I've updated the blog, but I Did want to mention that I am working on a neat article, which focuses on my passion for performance. Stay tuned for the latest details... in the mean time, have you ever been stuck with someone else's database? Or how'bout a vendor database where someone needs you to extend a task. Well finding the stored procedures is relatively simple. Remember just go through profiler, run the process and you can monitor which stored procedures are called sometimes this also provides you some feedback on which tables are being accessed. Other times you may need to report on some of this information, so you may need to search the database on where they decided to store such information. I extended my own version of Narayana's searchalltables procedure, in this new version you'll notice that you get to also search text (and ntext) fields along with only a single while loop. Check out the latest script and article here...

Mail Call!

Image
E mail, You use it, your colleges use it, even your systems use it. It's a part of everyday business. If you are a Sql Developer you have probably figured out how to implement email already, Often times I've seen many DBA's and Developers implement it from outside of SQL Server in rather ingenious ways... This article outlines how to setup Sql Server Mail in Sql Server 2000 and 2005 (2008 is the same as Sql Server 2005). By bringing mail inside of your server you can now send reports, alerts and other needed information based on the triggers and alerts that matter to you most. Making execution calls to xp_cmdshell to an opensource program (Blat) and sp_send_dbmail calls for Sql Server 2005 help leverage reporting from Sql Server. Sending E-mail from SQL Server 200X

Limit your responses , please.

When you are faced with request from users who will ask things like... i want to know the top 2 machines of every model type that have active leads, you may find yourself baffled and stunned to find that the Select TOP n does very little to help you out. The following article address the issue completely whether you're a sql developer or NOT. For myself it was a new look at existing solutions that we had employed all which were cumbersome and tedious to maintain, the solutions in the article describe the best approach which is easily extensible and flexible. Limit Groups by Number Using Transact-SQL or MS Access

MSDE enable TCP/IP or Named Pipes

When you inherit a new server sometimes you find that you can't connect to the server, to fix that you may need to simply enable the protocol via Sql Server Network Utility (svrnetcn) that is listening For MSDE. In Windows, click Start and Run . Enter svrnetcn and click OK . Under the General tab , verify that the correct instance for the server is displayed in the Instance(s) on this server box. Highlight your desired protocol and click Enable (double clicking the name also moves the protocol to the enabled protocols box). Click OK . Restart the Sql Server Instance In Windows, click Start and Run . enter services.msc Locate the MSSQLSERVER instance you modified in the Sql Server Network Utility and Restart the service. You may wish to ensure that your users are not logged on or at least notified of this change as it will kick them out of the application

SSIS SOS!

If you have been regretting making the move from Sql Server 2000 to Sql Server 2005, you will be in complete shock and awe when you find that you no longer have DTS to move your data around. The good news is that in Sql Server 2005 you get Sql Server Integration Services (SSIS) a full feature ETL product for Sql Server 2005. If you want to move things moving quickly take a look at the Sql Server 2005 Import / Export Wizard short article which outlines just how easy shuffling your data around can really be.

Comma delimited Lists

Take the post about finding columns and incorporate it with this post from a college of mine. http://www.artfulsoftware.com/infotree/tip.php?id=753 Now you're off and running turning lists to comma lists, in corporate that with the list table function I posted sometime back, and you can go backwards and forwards!

Find me a column...

Forgive the fact that the following SQL is not formatted , but this topic came up today on a list that I frequent, which was how to get all the fieldnames of a view (or table etc). this dandy little select statement will gather just that and all you need to really parse it for is your table name or column name... maybe you want to know how many times you named something "EntryTime" this is an easy way to find all that information at a glance. This is a Sql Server 2005 version (If you need it I can post a Sql Server 2000 version as well.) SELECT t.name AS TableName, sc.name AS SchemaName, c.name AS ColumnName, c.column_id AS ColumnID, c.precision AS [Precision], types.name AS TypeName, basetypes.name AS BaseTypeName, st.name AS TypeSchemaName, CASE WHEN c.max_length>=0 AND basetypes.name IN (N'nchar', N'nvarchar') THEN c.max_length/2 ELSE c.max_length END AS Length, c.scale AS Scale, CONVERT(bit, c.is_identity) AS [Identity], CONVERT(bit, c.is_computed) AS...

Turbo Charge Your SSMS

The other day a co-worker mentioned one of his biggest pet peeves about Sql's new IDE. Of course he likes the old IDE, but what he detested the most was the slow bloat time it took to get his SSMS loaded on the screen. When we timed the boot time for his Enterprise Manager to load it took nearly 7 seconds. Not bad, but then proceeded to tell me how much longer SSMS (Sql Server Management Studio) took to load. I guessed that it could possibly be about 10 seconds (only 3 more seconds) but I was shocked to see it load in nearly 25 seconds. it was nearly 3x less productive just loading the thing before you could connect to do anything. I couldn't believe that it was nearly that slow on his computer, I had never timed it on my pc. So when I returned I had to try it. Again the load time was nearly 20 seconds on my machine (about 18 seconds to be exact). I was not entirely pleased with my results but thankfully Google provided the answer, one quick search for "Turbo char...

One sandwich short of a picnic

I had an issue at work the other day, something that seems kind of odd to me. You see in Sql Server 2000 you could setup a view with an order by. Of course this required a TOP 100 PERCENT to be specified at the top of the query. You could then take that view and base new views off of it and all results would be ordered by the original view. In Sql Server 2005 (SP1 or even SP2) everything changed, now you could no longer get the correct order by if you coupled it w/ the TOP 100 PERCENT in your view, but then again, if you do not use a the TOP keyword you can't save your view. The solution to how to get around the issue is in the following blog article. http://executioniseverything.blogspot.com/2007/01/order-by-in-views-sql-server-2005.html A proposed solution has been placed on the MSDN site so you can vote on it. It seems the proposal is to do away with the ability to create ordered by views which technically go against the rules of rational theory.... https://connect.microso...