Friday, November 05, 2010

How do I get a list of SQL Server tables and their row counts?

url to article -> http://sqlserver2000.databases.aspfaq.com/how-do-i-get-a-list-of-sql-server-tables-and-their-row-counts.html
The one the I have used is:

SELECT
[TableName] = so.name,
[RowCount] = MAX(si.rows)
FROM
sysobjects so,
sysindexes si
WHERE
so.xtype = 'U'
AND
si.id = OBJECT_ID(so.name)
GROUP BY
so.name
ORDER BY
2 DESC

Labels:


Monday, December 07, 2009

10 things I can never remember how to do in Excel

1: Toggle the display of formulas

When you need to see what’s going on under the hood of a worksheet, you may want to turn on Excel’s formula display. There’s a convoluted way to do this via Excel options (and Excel 2007 offers the Show Formulas button in the Formula Auditing group of the Formulas tab - if you want to remember that). But you can toggle the display on the fly just by pressing [Ctrl] ~. If you select a cell whose formula you want to troubleshoot before turning on the display, Excel will also show you the dependent cells for the formula.

2: Convert a formula to its results

Sometimes, you may need to replace a formula with its results - either to preserve a static value or to optimize your sheet by reducing calculations. There’s a pretty simple trick for this, but a word of warning: Be sure you really want to wipe out a formula before you do it. (There could be undesirable consequences.) In fact, a good practice is to create a backup copy of the workbook as a safety net in case things go awry.

To convert a formula, click in its cell and press [F2] to enable in-cell editing. Next, press [F9] to calculate the formula and display its results. Then, hit [Enter], and your formula will be replaced by the value it produced.

You can also copy the formula and use Paste Special | Values to paste the results someplace else, leaving the formula intact in its original location.

3: Create a copy of an existing worksheet

Excel offers an efficient way to copy a worksheet, either within the current book or into a different one - handy when you need to start a new sheet that includes some or all of the data and/or formatting of an existing sheet. It works like this:

  1. Right-click on the sheet tab of the sheet you want to copy.
  2. Choose Move Or Copy.
  3. Select the Create A Copy check box in the bottom-left corner of the Move Or Copy dialog box.
  4. Choose a different workbook, if desired, from the To Book drop-down list. (That other workbook must be open to show up in the list.) You can also select New Workbook.
  5. In the Before Sheet list box, specify where you want the copied sheet to go within the specified workbook.
  6. Click OK.

4: Start a new line within a cell

This may seem beyond simplistic - until the day you can’t remember how to do it. If you need to create a multiple-line entry in a cell, you can’t just press [Enter] to insert a line break, since that will propel you into the next cell. Instead, you have to press [Alt][Enter].

5: Unhide hidden rows or columns

From time to time, someone will send me a worksheet with hidden rows or columns. I usually don’t need to see the data, so of course I forget how to unhide it on the rare occasions when I do need to see it. It’s easy, though: Highlight the row above and the row below the hidden row(s) - or the column to the left and to the right of the hidden column(s). Then, you can reveal the data in various ways:

6: Enter a fraction in a cell

Say you type 1/4 in a cell, wanting to enter the fraction one-fourth. Ordinarily, Excel will turn the value into a date - 4-Jan. To prevent that, just preface your entry with a zero and a space: 0 1/4. Excel will leave your fraction alone. Without the zero, you’ll see 1/4/2009 (or whatever year you happen to be in) in the Formula bar. With the zero, you’ll see 0.25.

7: Simultaneously copy data into noncontiguous cells

To copy data from one cell into adjacent cells, you just drag the cell’s fill handle across the cells where you want the copied data to appear. But sometimes, you’ll need to copy data into cells that are scattered around the worksheet. The most efficient way to handle that task is to copy the desired data, hold down [Ctrl], and select all the other cells where you want to paste the data. Then, press [Ctrl]V and Excel will insert the copied data into each of the selected cells.

8: Simultaneously enter data into noncontiguous cells

Similar to the previous trick, you can save time when you need to enter the same data into cells that aren’t next to each other. Start by holding down the Ctrl key and selecting all the cells into which you want to enter data. Then, type your data and press [Ctrl][Enter]. Excel will insert the data into all of the cells in the noncontiguous selection.

9: Enter text in the same location in multiple worksheets

This may not come up all that often, but it’s a cool trick when you need it. Let’s say that you’re entering month names as column headers at the top of a sheet - and you want them to appear on your other sheets as well. Click in the cell where you’ll be entering January. Then hold down [Ctrl] and click on the sheet tabs of the other sheets where you want the month names to appear. This will group the sheets so that what you do now affects all of them.

Go ahead and type January. Then (another cool trick coming…), drag the cell’s fill handle to the right across the next 11 cells. Excel recognizes that January is the first item in a built-in series, so it will insert the rest of the month names for you.

To complete the process, right-click on one of the selected sheet tabs and choose Ungroup Sheets from the shortcut menu. If you check those sheets, you’ll see your month names have been entered in all of them.

10: Transpose data from a row to a column, or vice-versa

Once in a while, I’ll set up a worksheet using one structure that seems to make sense, only to realize it would make a whole lot more sense if the rows were columns and the columns were rows. And apparently I’m not alone in this befuddlement, because Excel provides a Transpose option to facilitate the necessary flip-flopping of data:

  1. Select the range of cells you want to transpose and click Copy or press [Ctrl]C.
  2. Click in a new location (not overlapping your selection).
  3. Go to Edit | Paste Special and select the Transpose check box. In Excel 2007, click Paste in the Clipboard group of the Home tab and select Transpose.
  4. You can then delete your original, wrong-structured data.


Thursday, July 31, 2008

JPeg To CSS Converter

Here is a really cool “proof of concept” (as the author puts it) program: jpeg2css. The program literally does exactly as you would expect:It takes a black and white jpeg and returns an html copy of the image created with text and CSS

Labels: ,


Maintain Shared Computers In A Safe State

A problem with maintaining shared computers (i.e. training machines) is it hard to keep the machines all in a predictable working condition. Many programs require more than mere ‘user’ level access meaning student logins may need ‘power user’ or even ‘administrator’ access. Of course, with increased access comes increased risk as students could potentially download and install malicious files.

A tool to help combat this is SteadyState. This free tool from Microsoft reverts a Windows installation back to a safe state after use. The most appealing feature states:

Windows Disk Protection – Help protect the Windows partition, which contains the Windows operating system and other programs, from being modified without administrator approval.Windows SteadyState allows you to set Windows Disk Protection to remove all changes upon restart, to remove changes at a certain date and time, or to not remove changes at all. If you choose to use Windows Disk Protection to remove changes, any changes made by shared users when they are logged on to the computer are removed when the computer is restarted.

Labels:


Free Remote Connection Software

When it comes to remote connection (either attended or unattended), there are several choices you have: Terminal Services (for Windows users), VNC, commercial services, etc. just to name a few. If you do not have something in place already, take a look at TeamViewer.

This free service (for non-commercial use) allows you to both share your computer desktop with others or take control of another computer. The benefits are obvious as you can show someone how to do something or actually do it for them. One great feature about TeamViewer, however, is that it does not require any software installation (for live connection, unattended access requires installation) in order to connect to a client. Additionally, like most other commercial products, firewalls do not present any problems so nobody has to worry about lingering security implications.

Labels: , ,


GUI Tool For Robocopy

While the syntax between XCopy and Robocopy is similar, those not comfortable with the command line may want to shy away from this tool due to the sheer number of options available. No worries, if this is the case then simply download the Robocopy GUI. This free tool takes all the functionality of the Robocopy command line tool and lets you build your instructions in a point and click interface. One of the nice features of Robocopy is the built in scheduling functionality, so you could actually schedule times to copy files straight from this tool.

Labels: ,


Defragging The Windows Page File

Whenever you defrag your hard drive (using the tool which ships with Windows), you might notice there is a big green block which not movable. For the most part this green block is your Windows page file. Typically the way to make sure this gets defragged is to simply “delete it” by (steps abbreviated) removing the page file, defragging the hard drive and then re-setup the page file. Instead of this workaround, defrag the page file directly by using Sysinternals PageDefrag tool.

This free tool does just what you think, defrags your page file:

PageDefrag uses advanced techniques to provide you what commercial defragmenters cannot: the ability for you to see how fragmented your paging files and Registry hives are, and to defragment them. In addition, it defragments event log files and Windows 2000/XP hibernation files (where system memory is saved when you hibernate a laptop).

Labels: ,


This page is powered by Blogger. Isn't yours?