-- Declare a I_LOCK_YOU procedure
BEGIN TRAN I_LOCK_YOU;
-- simply select any table we intend to lock.
SELECT TOP (1000) * FROM VOUCHER.TICKET TKT (HOLDLOCK) JOIN VOUCHER.TRANS TRN (HOLDLOCK) ON TRN.TKT_ID = TKT.TKT_ID
WHERE TRN.STAT_ID = 3;
-- You can sleep as long as you like.
WAITFOR DELAY '00:00:04';
COMMIT TRAN I_LOCK_YOU;
Showing posts with label SQL. Show all posts
Showing posts with label SQL. Show all posts
Wednesday, October 17, 2012
Tuesday, July 03, 2012
Microsoft SQL Server Command Line Tool SQLCMD
SQL Server Command Line Tool SQLCMD can be download from here:
http://www.microsoft.com/en-us/download/confirmation.aspx?id=16978
1. In the above website, search for "Native Client" --> Microsoft® SQL Server® 2008 R2 Native Client
2. In the above website, search for "sqlcmd" --> Microsoft® SQL Server® 2008 R2 Command Line Utilities
The SQLCMD utility allows users to connect to, send Transact-SQL batches from, and output rowset information from SQL Server 7.0, SQL Server 2000, SQL Server 2005, and SQL Server 2008 and 2008 R2 instances. The bcp utility bulk copies data between an instance of Microsoft SQL Server 2008 R2 and a data file in a user-specified format. The bcp utility can be used to import large numbers of new rows into SQL Server tables or to export data out of tables into data files.
Note: This component requires both Windows Installer 4.5 and Microsoft SQL Server Native Client
Install items 1 and 2.
SQLCMD.exe can be found here: C:/Program Files/Microsoft SQL Server/100/Tools/Binn/SQLCMD.EXE
http://www.microsoft.com/en-us/download/confirmation.aspx?id=16978
1. In the above website, search for "Native Client" --> Microsoft® SQL Server® 2008 R2 Native Client
2. In the above website, search for "sqlcmd" --> Microsoft® SQL Server® 2008 R2 Command Line Utilities
The SQLCMD utility allows users to connect to, send Transact-SQL batches from, and output rowset information from SQL Server 7.0, SQL Server 2000, SQL Server 2005, and SQL Server 2008 and 2008 R2 instances. The bcp utility bulk copies data between an instance of Microsoft SQL Server 2008 R2 and a data file in a user-specified format. The bcp utility can be used to import large numbers of new rows into SQL Server tables or to export data out of tables into data files.
Note: This component requires both Windows Installer 4.5 and Microsoft SQL Server Native Client
Install items 1 and 2.
SQLCMD.exe can be found here: C:/Program Files/Microsoft SQL Server/100/Tools/Binn/SQLCMD.EXE
Thursday, June 07, 2007
Oracle SQL command to create user
Since everytime I'll forget the exact commands, I shall record it here.
The following is the simplest way to create an Oracle user:
-- 1. Create Tablespace "MYDB"
CREATE TABLESPACE "MYDB"
LOGGING DATAFILE '/u02/oradata/ora10gdb/mydb.dbf'
SIZE 200M AUTOEXTEND ON NEXT 10M MAXSIZE UNLIMITED;
-- 2. If temporary table space is needed, script to create temporary table space.
CREATE TEMPORARY TABLESPACE "TEMPORARY"
TEMPFILE '/u02/oradata/ora10gdb/TEMPORARY.dbf'
SIZE 50M
EXTENT MANAGEMENT LOCAL
UNIFORM SIZE 10M;
-- 3. Create User "MYDB"
CREATE USER "MYDB" PROFILE "DEFAULT" IDENTIFIED BY "MYDB"
DEFAULT TABLESPACE "MYDB" TEMPORARY TABLESPACE "TEMP" ACCOUNT UNLOCK;
GRANT "CONNECT" TO "MYDB";
GRANT "RESOURCE" TO "MYDB";
The following is the simplest way to create an Oracle user:
-- 1. Create Tablespace "MYDB"
CREATE TABLESPACE "MYDB"
LOGGING DATAFILE '/u02/oradata/ora10gdb/mydb.dbf'
SIZE 200M AUTOEXTEND ON NEXT 10M MAXSIZE UNLIMITED;
-- 2. If temporary table space is needed, script to create temporary table space.
CREATE TEMPORARY TABLESPACE "TEMPORARY"
TEMPFILE '/u02/oradata/ora10gdb/TEMPORARY.dbf'
SIZE 50M
EXTENT MANAGEMENT LOCAL
UNIFORM SIZE 10M;
-- 3. Create User "MYDB"
CREATE USER "MYDB" PROFILE "DEFAULT" IDENTIFIED BY "MYDB"
DEFAULT TABLESPACE "MYDB" TEMPORARY TABLESPACE "TEMP" ACCOUNT UNLOCK;
GRANT "CONNECT" TO "MYDB";
GRANT "RESOURCE" TO "MYDB";
Subscribe to:
Posts (Atom)