(toiminnot)

hwechtla-tl: Handy command line client for TDS databases: viime muutokset

[...]

exec_sql() { echo "$*" | \ bsqldb -q -h -t '|-|' -S "$SERVER" -D "$DATABASE" -U "$USER" -P "$PASSWORD" }

to_html() { echo '

' sed 's#&#\&#g;s#<#\<#g;s#>#\>#g' | \ sed 's#^##;s#|-|#\(
#;s#$#
#g' | \ sed '/
-*<\/td>\)*<\/tr>/{;s#.*#
#p;d;};${;x;p;};x' echo '
' }

while true; do read -p "> "sql> " QUERY exec_sql "$QUERY" | to_html | w3m -dump -T text/html done }}}

If you just want CSV instead of tabulated output, replace | to_html | w3m -dump -T text/html with e.g. | sed 's/|-|/;/g' | less (or something similar). similar, or leave it out altogether).

[...]

* list all tables in your database (from sysobjects): database: {{{ > sql> sp_tables }}}

* list all kinds of stuff in your database: {{{ sql> select name,type from sysobjects }}}

* show the definition of a table (from (this information comes from syscolumns): {{{ > sql> sp_help tablename }}}

* show the definition of a view, stored procedure or similar (from (this information comes from syscomments): {{{ > sql> sp_helptext viewname }}}

[...]


(viimeksi muutettu 08.01.2015 10:36)