0% found this document useful (0 votes)
13 views

Sqlsplus Ug

Uploaded by

fatimanzenacht
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

Sqlsplus Ug

Uploaded by

fatimanzenacht
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

1

Using SQLS*Plus for SQL Server

Chapters:
hapters: Page
SQLS*Plus license registration, startup scripts and commands reference 2
Making command window suitable work environment 6

1
Chapter 1
Register License:

Issue “sqlsplus.exe –r” command and paste your license token to register SQLS*Plus

Startup Scripts

When SQLS*Plus starts, and after CONNECT commands, the two sql files are being executed:

1) login.ssp - SQLS*Plus profile

2) login.sql - User profile

The files may contain SQLS*Plus commands.

2
List of SQLS*Plus Commands
& &<variable name> Use substitution variable

&& &&<variable name> Use substitution variable

/ Executes the SQL command


or batch currently stored in
the SQL buffer
AGAIN |!! Again | !!<number> Rerun latest matching entry
or command from history

CAT cat <table_name> -a Synonym for “select * from


<table/view name”

Cat <table/view name>

Selects first 3000 rows

Options: -a – select all rows

CD cd <directory_name> Change current directory


location
COLUMN | COL col <name> format <format> Set column format

CONNECT | connect Create a new session


CONN user/password@ip[\\instance_name]
Connect creates a database
-a create additional session. Multiple sessions
session, don't can exists at the same time
disconnect
-l create additional
session, don't
disconnect
-s switch to session (as
<sess_num> reported by -l)

COUNT Count rows in the tables


DEFINE DEF[INE] [variable]|[variable = text] Define a variable and
assigns a value to it, or lists
-l list defines the value and variable type
of a single variable or all
variables
DEPS DEPS [NAME] Object dependencies and
references
-r list dependencies recursively
DESCRIBE Describe a table or stored
procedure
DIR List file directory
3
DISCONNECT Disconnect session
EDIT | ED Edit current statement
EXEC Execute T-SQL procedure

FIND Find a line in T-SQL


procedure source
GREP grep <pattern table [extra clause]> Show rows that match
pattern
-v show rows that don't match pattern
-I ignore case

Search pattern across all table columns


HEAD Show first rows of table
HELP Provide help for a command
HISTORY | HI Show history items matching
pattern (or all)
HOST Execute host OS command
LIST List last sql statement
LS List all objects matching
pattern
PRINTVAR Print bind variables
PROMPT Sends the specified message
or a blank line to the user's
screen
PURGE purge <table where ...> Delete from (large) table in
chunks
-c print table count at the end
-n 1000 chunk size Purge executes a series (-i)
-i 1000 max iterations of delete statements, where
-q be quiet each statement deletes (-n)
rows at a time and commits.
You can specify an additional “where”
clause:

purge Table where id=23

PWD Show current directory


QUIT Leave SQLS*Plus.
RECOMPILE Recompile objects
REFS Display referential integrity
dependencies
REM
RERUN rerun <history_number> Run history item number
SET COLSEP Set column separator
character
SET DDVIEW Switch between user and all
views in Data Dictionary
SET HEADING Set heading value
SET HEADSEP Set heading separator
SET LINESIZE | Set output line size
4
LINES
Set output page size
SET PAGESIZE |
PAGES

SET VERIFY Print ampersand replacing


SET VOUT set vout on|off Set vertical output mode
SHOW Show current database
DB|DATABASE
SHOW Show available databases
DBS|DATABASES
SHOW Show database tables
TABLES|TAB
SHOW ERRORS Show server error log
SHOW USER Show the current username
SPOOL spool <file_name> Write output to file
START | @ Execute sql script

STARTREL | @@ Execute sql script relative /


nested to a running script
TSQL Display t-sql procedure code
VARIABLE declare a bind variable

Some Highlights:

• Vertical Output – allows to see large column sets as a vertical output

• Table data grep – search for data across all columns

• Data purge – purge table data in a small chunks

5
Chapter 2
Making Command Window a suitable work environment

1) Activate Quick Edit Mode

6
2) Set proper layout attributes

a) Set Screen Buffer Size to 122 and 9999 correspondingly

b) Set Window Buffer Size to 122 and 55 correspondingly

7
3) Set “easy to work with” Colors

Set Screen Background to White Set Screen Text to Black

You might also like