Skip to content

SQL Server Tables

Menu: Database → SQL Server Tables
Deep link: /_Admin/database/sqlserver-table?SiteId={siteGuid}

SQL Server tables let you browse and manage tables in a connected external SQL Server database from the admin: create tables, maintain columns and data, and import / export CSV. Configure the SqlServer connection string under Service integrations first; scripts use k.DB.sqlServer for SQL or table objects. Child routes must include dbType=SqlServer; the left menu highlights SQL Server Tables.

Permissions

Same as SQLite tables: database (view), database·edit, database·delete.
Configuring the connection string requires Service integrations config·edit.

Difference from MySQL / SQLite

SQL Server tablesMySQL tablesSQLite tables
Data sourceExternal SQL ServerExternal MySQLSite built-in SQLite
Service integration itemDatabase → SqlServerDatabase → MysqlNot required
dbTypeSqlServerMySqlSqlite
Scriptk.DB.sqlServerk.DB.mysqlk.DB.sqlite
SQL log typesqlservermysqlsqlite

Column editing and data browsing share the same pages as MySQL tables and SQLite tables (relational DB UI is consistent; only IndexedDB column settings include primary key/unique/auto-increment).

Configure SQL Server connection

  1. Open Site settings → Service integrations: /_Admin/system/config?SiteId={siteGuid}
  2. Expand the Database group and edit SqlServer. See Service integrations · Database.
  3. Enter the connection string (ConnectionString) and save.

Example format (follow Kooboo built-in guidance):

text
Data Source=127.0.0.1;Initial Catalog=mydb;User ID=sa;Pwd=123

You can also click Configure now on the SQL Server Tables unconfigured guide page to jump to /_Admin/system/config?SiteId={siteGuid}&group=Database.

Security

Connection strings contain credentials; do not commit them to public repositories. Use least-privilege database users in production. Kooboo applies common TLS certificate options when connecting (e.g. TrustServerCertificate); exact behavior depends on the deployment driver.

How to Open

  1. In Edit Menu, check Database → SQL Server Tables.
  2. Complete Configure SQL Server connection.
  3. Open Database → SQL Server Tables in the left sidebar.

When not configured or the connection is invalid, the page shows an error and Configure now; no table list is shown.

SQL Server unconfigured guide

After a successful connection, list, columns, data, CSV import, and other UIs share the same pages as SQLite tables (only dbType=SqlServer and menu highlight differ). Screenshots below use SQLite as an example; SQL Server looks the same once configured.

Table List

ActionPermissionDescription
Create tabledatabase·editCreate table in SQL Server and register admin schema
Click NamedatabaseOpen table data
Settings (gear)databaseOpen column settings
Multi-select Deletedatabase·deleteDelete selected physical tables (use with care)

Table name rules match IndexedDB / SQLite: 1–50 characters, letter or digit start, letters and digits only.

Table list (same UI as SQLite tables)Create table toolbarTable name list example

Create table dialog

Create table dialog

Column Settings

Route example:

text
/_Admin/database/table/columns?SiteId={siteGuid}&table={tableName}&dbType=SqlServer

Same as SQLite column settings: list shows column name, control type, index; column editor has no length, auto-increment, or primary key/unique (IndexedDB only). Save updates SQL Server table structure and admin control mapping.

Column settings (same UI as SQLite tables)Column editor dialog

Table Data

Route example:

text
/_Admin/database/table/data?SiteId={siteGuid}&table={tableName}&dbType=SqlServer

Toolbar

ButtonPermissionDescription
New datadatabase·editOpen edit page
Export datadatabaseExport CSV
Import datadatabase·editCSV import
SettingsJump to column settings
Table data toolbarTable data list

CSV import

Fields and flow match SQLite CSV import: skip rows, upload .csv, field mapping (required/unique), optional overwrite.

CSV import dialog

Edit Data

Route example:

text
/_Admin/database/table/edit-data?SiteId={siteGuid}&table={tableName}&dbType=SqlServer

Form rendered by column control type; Save / Cancel returns to the data list.

Script access (development)

typescript
const rows = k.DB.sqlServer.query(
  "SELECT * FROM orders WHERE id = @id",
  { id: 1 }
)
k.DB.sqlServer.execute(
  "INSERT INTO orders (order_no, amount) VALUES (@no, @amt)",
  { no: "A1001", amt: 99 }
)
const table = k.DB.sqlServer.getTable("orders")

When Default database under Site settings → Advanced is set to SqlServer, k.DB.sql and k.DB.sqlServer point to the same instance.

See k.DB (sqlServer shares relational APIs with mysql / sqlite: query / execute / getTable / procedure, etc.).

SQL logs

With site SQL logging enabled, statements from k.DB.sqlServer can be filtered by type SQLServer in SQL logs.

Typical workflow

  1. Configure SqlServer under Service integrations and verify connectivity.
  2. Open SQL Server Tables, Create table or manage existing database tables.
  3. Settings for columns and control types; New data or Import CSV.
  4. Read/write in Code with k.DB.sqlServer; check SQL logs when troubleshooting.
DocDescription
MySQL tablesSimilar external MySQL
SQLite tablesBuilt-in database; no connection
k.DBScript API
SQL logsExecution records
Database overviewMenu overview