You are here
Home > Software Development > Database

MS SQL Server Cheatsheet

Reseeding a table identity in MS SQL Server DBCC CHECKIDENT (tablename, RESEED, new_reseed_value) Truncate Table truncate tablename Check Log size of all database DBCC SQLPERF(LOGSPACE);   Connection String Standard Security: 1. Server=ServerNameOrIpAddress;Database=DatabaseName;User Id=Username; Password=Password; Trusted Connection: 2. Server=ServerNameOrIpAddress;Database=DatabaseName;Trusted_Connection=True; Connection to a SQL Server instance: 1. Server=ServerNameOrIpAddress\InstanceName;Database=DatabaseName;User Id=myUsername;Password=Password; Trusted Connection from a CE device: 1. Data Source=ServerNameOrIpAddress;Initial Catalog=DatabaseName;Integrated Security=SSPI; User ID=myDomain\myUsername;Password=Password; Connect via an IP address: 1. Data

MySQL Cheatsheet

Login to MySql: mysql -u username -p password Create Database: create database databasename character set utf8 collate utf8_general_ci; grant all on databasename.* to databaseUser@'localhost' identified by 'password'; Delete Database: drop database databasename Import Database: mysql -u username -p password databasename < /importfilePath Import Database: mysqldump -u username -p password databasename > /exportfilePath List all Databases: show databases; Select Database: use databasename; List Tables of a