Category Archives: Uncategorized

SQL Server: Why to Avoid TRIM functions in WHERE and JOIN clauses

Trim functions (LTRIM & RTRIM) are most favorite function of most developers but how negatively effect these functions on query performance, if these are used in WHERE or JOIN clauses. WHY..Read here

Advertisements

SQL Server: Keeping Log of Each Query Executed Through SSMS

During a normal working day, a DBA or Developer executes countless queries using SQL Server Management Studio. Some of these queries, which are thought important, are saved and roughly 80% of query windows are closed without pressing save button. But after few minutes, hours or even days, most DBAs and Developers like me want their quires back, which they have executed but can’t save. more…

SQL Server: Float to Varchar Conversion

Recently, someone asked that, if we convert float value to varchar then result is truncated and what is the best way to get whole value converted into varchar without any truncation.
DECLARE @FloatVal FLOAT
SELECT @FloatVal = 421.765433
First lets check, how SQL Server implicitly converts float value to varchar
DECLARE @VarcharVal VARCHAR(50)
SELECT @VarcharVal = @FloatVal
SELECT @VarcharVal

OOPS. Implicit conversion from float to varchar is NOT according to our required output. Let convert it explicitly and then assign this value to varchar variable.
SELECT @VarcharVal = CAST(@FloatVal AS VARCHAR(50))
SELECT @VarcharVal
You will observe same truncated value as a result of above query. Finally,let’s try it with convert as convert supports some formatting too.
SELECT CONVERT (VARCHAR(50), @FloatVal,128)

Yeah, that’s what we were looking for.

Yeah, that’s what we were looking for.

Commonly Used KeyBoard Shortcut Keys for Sql Server 2005

Menu Activation Keyboard Shortcuts

Action

Standard

Sql Server 2000/2005

Move to the SQL Server Management Studio menu bar

ALT

ALT

Activate the menu for a tool component

ALT+HYPHEN

ALT+HYPHEN

Display the context menu

SHIFT+F10

SHIFT+F10

Display the New File dialog box to create a file

CTRL+N

No equivalent

Display the New Project dialog box to create a new project

CTRL+SHIFT+N

CTRL+SHIFT+N

Display the Open File dialog box to open an existing file

CTRL+O

CTRL+SHIFT+INS

Display the Open Project dialog box to open an existing project

CTRL+SHIFT+O

No equivalent

Display the Add New Item dialog box to add a new file to the current project

CTRL+SHIFT+A

No equivalent

Display the Add Existing Item dialog box to add an existing file to the current project

ALT+SHIFT+A

No equivalent

Display the Query Designer

CTRL+SHIFT+Q

CTRL+SHIFT+Q

Close a menu or dialog box, canceling the action

ESC

ESC

Windows Management and Toolbar Keyboard Shortcuts

Action

Standard

Sql Server 2000/2005

Close the current MDI child window

CTRL+F4

CTRL+F4

Print

CTRL+P

CTRL+P

Exit

ALT+F4

ALT+F4

Toggle full screen mode

SHIFT+ALT+ENTER

SHIFT+ALT+ENTER

Close the current tool window

SHIFT+ESC

SHIFT+ESC

Cycle through the next MDI child windows

CTRL+TAB

CTRL+TAB

Cycle through the previous MDI child windows

CTRL+SHIFT+TAB

CTRL+SHIFT+TAB

Move to the current tool window toolbar

SHIFT+ALT

No equivalent

Move to the next tool window

ALT+F6

ALT+F6

Move to the previously selected window

SHIFT+ALT+F6

SHIFT+ALT+F6

Opens a new query editor window

No equivalent

CTRL+O

Display Object Explorer

F8

F8

Display Registered Servers

CTRL+ALT+R

No equivalent

Display Template Explorer

CTRL+ALT+T

CTRL+ALT+T

Display Solution Explorer

CTRL+ALT+L

CTRL+ALT+L

Display the Summary Window

F7

F7

Display the Properties Window

F4

F4

Display the Toolbox

CTRL+ALT+X

CTRL+ALT+X

Display the Bookmarks Window

CTRL+K, CTRL+W

No equivalent

Display the Browser Window

CTRL_ALT+R

CTRL_ALT+R

Text Selection Keyboard Shortcuts

Action

Standard

Sql Server 2000/2005

Select text from the cursor to the beginning of the document

CTRL+SHIFT+

HOME

CTRL+SHIFT+

HOME

Select text from the cursor to the end of the document

CTRL+SHIFT+END

CTRL+SHIFT+END

Select text from the cursor to the start of the current line

SHIFT+HOME

SHIFT+HOME

Select text from the cursor to the end of the current line

SHIFT+END

SHIFT+END

Select text down line by line starting from the cursor

SHIFT+

DOWN ARROW

SHIFT+

DOWN ARROW

Select text up line by line starting from the cursor

SHIFT+UP ARROW

SHIFT+UP ARROW

Move the cursor up one line, extending the selection

SHIFT+ALT+

UP ARROW

SHIFT+ALT+

UP ARROW

Extend selection up one page

SHIFT+

PAGE UP

SHIFT+

PAGE UP

Extend selection down one page

SHIFT+

PAGE DOWN

SHIFT+

PAGE DOWN

Select the entire current document

CTRL+A

CTRL+A

Select the word containing the cursor, or the closest word

CTRL+W

CTRL+W

Select the current location in the editor, back to the previous location in the editor

CTRL+=

CTRL+=

Extend the selection to the top of the current window

CTRL+SHIFT+

PAGE UP

CTRL+SHIFT+

PAGE UP

Move the cursor to the last line in view, extending the selection

CTRL+SHIFT+

PAGE DOWN

CTRL+SHIFT+

PAGE DOWN

Extend the selection one word to the right

CTRL+SHIFT+

RIGHT ARROW

CTRL+SHIFT+

RIGHT ARROW

Extend the selection one word to the left

CTRL+SHIFT+

LEFT ARROW

CTRL+SHIFT+

LEFT ARROW

Move the cursor to the right one word, extending the selection

CTRL+SHIFT+ALT+

RIGHT ARROW

CTRL+SHIFT+ALT+

RIGHT ARROW

Move the cursor to the left one word, extending the selection

CTRL+SHIFT+ALT+

LEFT ARROW

CTRL+SHIFT+ALT+

LEFT ARROW

Text Manipulation in Code Editor Keyboard Shortcuts

Action

Standard

Sql Server 2000/2005

Insert a new line

ENTER or SHIFT+ENTER

ENTER or SHIFT+ENTER

Swap the characters on either side of the cursor

CTRL+T

No equivalent

Delete on character to the right of the cursor

DELETE

DELETE

Delete one character to the left of the cursor

BACKSPACE

or

SHIFT+

BACKSPACE

BACKSPACE

or

SHIFT+

BACKSPACE

Insert the number of spaces configured for the editor

TAB

TAB

Insert a blank line above the cursor

CTRL+ENTER

CTRL+ENTER

Insert a blank line below the cursor

CTRL+SHIFT+

ENTER

CTRL+SHIFT+

ENTER

Change the selected text to lowercase

CTRL+SHIFT+L

CTRL+SHIFT+L

Change the selected text to uppercase

CTRL+SHIFT+U

CTRL+SHIFT+U

Toggle between insertion mode and overtype mode

INSERT

INSERT

Move selected lines to the left on tab stop

SHIFT+TAB

SHIFT+TAB

Delete the word to the right of the cursor

CTRL+DELETE

CTRL+DELETE

Delete the word to the left of the cursor

CTRL+BACKSPACE

CTRL+BACKSPACE

Transpose the words on either side of the cursor

CTRL+SHIFT+T

CTRL+SHIFT+T

Search Keyboard Shortcuts

Action

Standard

Sql Server 2000/2005

Display the Find dialog box

CTRL+F

CTRL+F

Display the Replace dialog box

CTRL+H

CTRL+H

Start incremental search. Type the characters to search for or press CTRL+I to search for characters from the previous search

CTRL+I

CTRL+B

Find the next occurrence of the previous search text

F3

F3

Find the previous occurrence of the search text

SHIFT+F3

SHIFT+F3

Find the next occurrence of the currently selected text

CTRL+F3

CTRL+F3

Find the previous occurrence of the currently selected text

CTRL+SHIFT+F3

CTRL+SHIFT+F3

Display the Replace in Files dialog box

CTRL+SHIFT+H

CTRL+SHIFT+H

Reverse incremental search so it starts at the bottom of the file and searches to the top

CTRL+SHIFT+I

CTRL+SHIFT+I

Select or clear the Search up option in Find and Replace

ALT+F3, B

ALT+F3, B

Stop the Find in Files search

ALT+F3, S

ALT+F3, S

Select or clear the Find whole word option in Find and Replace

ALT+F3, W

ALT+F3, W

Selects or clears the Wildcard option in Find and Replace

ALT+F3, P

ALT+F3, P

Activity Monitor Keyboard Shortcuts

Action

Standard

Sql Server 2000/2005

Refresh

F5

F5

Filter the monitor display

CTRL+SHIFT+F

CTRL+SHIFT+F