Skip to main content

Posts

Showing posts from 2007

Why ' set ANSI_NULL ON ' while writing SP

-- Create table t1 and insert values. CREATE TABLE t1 (a INT NULL) INSERT INTO t1 values (NULL) INSERT INTO t1 values (0) INSERT INTO t1 values (1) GO When SET ANSI_NULLS is ON, all comparisons against a null value evaluate to UNKNOWN.  -- SET ANSI_NULLS to ON and test. SET ANSI_NULLS ON GO DECLARE @varname int =  NULL SELECT * FROM t1  WHERE a = @varname  -- No output SELECT * FROM t1  WHERE a <> @varname -- No output SELECT * FROM t1  WHERE a IS NULL     -- NULL  GO When SET ANSI_NULLS is OFF, comparisons of all data against a null value evaluate to TRUE if the data value is NULL -- SET ANSI_NULLS to OFF and test. SET ANSI_NULLS OFF  GO DECLARE @varname int =  NULL SELECT * FROM t1  WHERE a = @varname  -- NULL SELECT * FROM t1  WHERE a <> @varname -- 0 , 1 SELECT * FROM t1  WHERE a IS NULL     -- NULL  GO -- Drop table t1. DROP TABLE t1

Resolve conflicting changes in a shared workbook

Sharing Made Easy continued... When you are sharing something conflicts are bound to happen. A conflict happens when two users are both editing the same shared workbook and try to save changes that affect the same cell. Excel can keep only one of the changes in that cell. When the second user saves the workbook, Excel displays the RESOLVE CONFLICTS dialog box. 1. In the RESOLVE CONFLICTS dialog box, read the information about each change and the conflicting changes made by the other user. 2. To keep your change or the other person's change and to advance to the next conflicting change, click ACCEPT MINE or ACCEPT OTHER. To keep all of your remaining changes or all of the other user's changes, click ACCEPT ALL MINE or ACCEPT ALL OTHERS. To override resolve conflicts dialog To have your changes override all other changes without displaying the RESOLVE CONFLICTS dialog box again,: click SHARE WORKBOOK. On the ADVANCED tab, under CONFLICTING CHANGES BETWEEN USERS, cli

Sharing Made Easy - Excel

Its extremely easy to create a workbook and place it on a network location where several people can edit the contents simultaneously. For example, if the people in your work group each handle several projects and need to know the status of each other's projects, the group can use a shared workbook to track the status of the projects. All persons involved can then enter the information for their projects in the same workbook. As the owner of the shared workbook, you can manage it by removing users from the shared workbook and resolving conflicting changes. When all changes have been incorporated, you can stop sharing the workbook. Share A Workbook Not all features are supported in a shared workbook. If you want to include any of the following features, you should add them before you save the workbook as a shared workbook: merged conditional formats data validation, charts, pictures, objects including drawing objects, hyperlinks scenarios, outlines subtotals, data tables PivotTa

T-SQL Conditional looping....WHILE

Conditional Looping means executing the same code again and again, as long as the specified condition is true. 'WHILE' statement helps in executing a statement or a block of statement repeatedly, till the specified condition(s) is true. The number of times depends on the condition statement writen after the 'WHILE' keyword. The execution of statements in the WHILE loop can be controlled from inside the loop with the BREAK and CONTINUE keywords. Break causes an exit from the innermost WHILE loop. Any statements that appear after the END keyword, marking the end of the loop, are executed.  CONTINUE  causes the WHILE loop to restart, ignoring any statements after the CONTINUE keyword. Syntax for WHILE WHILE ( Boolean_expression )    BEGIN    'Sql Statement Block'    END Simple WHILE Example    WHILE (x>y)        BEGIN        SELECT 'If x is greater than y, this statement will be executed'        x = x + 1        END Nested WHILE Exam

Saving changes to table design made easy

Want to make changes to the database table in Microsoft SQL Management Studio, but getting the following message "Saving changes is not permitted" (figure 1)   Step 1: Go to Tools, and click on Options. The following screen gets displayed. Step 2: Click on Designers => Table and Database Designers (highlighted above). Step 3: Unchecke "Prevent saving changes that require table re-creation" and click on 'OK' Note: You may also unchecked 'Warn about tables affected'. If this is checked you will see the following message. Click on OK. All the requested changes are saved. Done!!

T-SQL IF...ELSE Statement

You must have been in a situation wherein you have to select between this or that, right or left depending on your present situation. If you were to stimulate this kind of situation in SQL, you need to use the IF-ELSE statement. IF - ELSE is the most commonly used Transact SQL command, that executes a statement depending on the condition. If the condition for IF statement is True, the statements inside the 'Begin-End' loop of 'IF' statement will be executed. If the condition for IF statement is False, the statements inside the 'Begin-End' loop of 'ELSE' statement will be executed. Thus, depending on which condition is true, statement or block of statements are executed The basic Syntax for IF..ELSE is: IF ( Boolean_expression )    BEGIN    'Sql Statement Block'    END ELSE    BEGIN    'Sql Statement Block'    END Simple If..Else Statement example IF (x>y)    BEGIN    SELECT 'If x is greater than y, this statement

Selecting Cells - The Faster Way

If you wish to perform a function on a group of cells, you must first select those cells by highlighting them. The exercises that follow teach you how to select. To select cells A1 to E1: Go to cell A1. Press the F8 key. This anchors the cursor. Note that "Extend Selection" appears on the Status bar in the lower-left corner of the window. You are in the Extend mode. Click in cell E7. Excel highlights cells A1 to E7. Press Esc and click anywhere on the worksheet to clear the highlighting. Alternative Method:     Select Cells by Dragging You can also select an area by holding down the left mouse button and dragging the mouse over the area. In addition, you can select noncontiguous areas of the worksheet by doing the following: Go to cell A1. Hold down the Ctrl key. You won't release it until step 9. Holding down the Ctrl key enables you to select noncontiguous areas of the worksheet. Press the left mouse button. While holding down the left mouse button,

30+ shortcuts to speed up your calculations - Excel

Select the current column [Ctrl] + [Space] Select the current row [Shift] + [Space] Edit the active cell [F2] Move to the beginning of the worksheet [Ctrl] + [Home] Move to the last cell on the worksheet [Ctrl] + [End] Paste a name into a formula [F3] Paste a function into a formula [Shift] + [F3] Alternate value/formula view [Ctrl] + [`] (on key [1]) Calculate all sheets in all open workbooks [F9] To go to a cell quickly [F5] or [Ctrl] + [G] Display the Find dialog box [Shift] + [F5] Display the Format Cells dialog box [Ctrl] + [1] Create a chart [F11] Insert a new sheet [Alt] + [Shift] + [F1] Repeat the last action [F4] Repeat Find [Shift] + [F4] Open [Ctrl] + [F12] Exit [Ctrl] + [F4] Check spelling of current cell [F7] Activate the menu bar [F10] Display the Macro dialog box [Alt] + [F8] Apply outline to active cell [Ctrl] + [Shift] + [&] Convert to a percentage [Ctrl] + [Shift] + [%] Select all filled cells around active cell [Ctrl]