Program | data | database | Display ' Define your SQL info here
STRSQLDSN = "xxxx"
Strsqlusername = "sa"
Strsqlpassword = ""
' This is where we connect to our SQL Server
Set adoconn = Server.CreateObject ("ADODB. Connection ")
ConnectionString = "dsn=" Strsqldsn "Uid=" Strsqlusername ";p wd=" Strsqlpassword ""
Adoconn.open ConnectionString
Set adors = Serv
Label:Transferred from: http://www.cnblogs.com/aflyfly/archive/2011/08/10/2133546.html actinium Fly MS SQL Server1. Query All TablesSelect [ID], [name] from [sysobjects] where [type] = ' u ' ORDER by [name]2. Query all databases3. Select [Name] from [sysdatabases] ORDER by [name]Querying fields in a tableSelect [Name] from [syscolumns] where [name] = ' tablexxx '
Obtain table records of all tables and SQL statements that use space
Exec sp_msforeachtable@ Precommand = N'Create Table ##(Id int identity,Table Name sysname,Number of fields int,Number of records int,Reserved space nvarchar (10 ),Use space varchar (10 ),Index space varchar (10 ),Unused space varchar (10 ))',@ Command1 = n' insert ## (Table Name, number of reco
databases created on the instance of SQL Server. Because tempdb is created every time SQL Server is started, the model database must always exist in the SQL Servers system. When the CREATE DATABASE statement is issued, the first part of the database is created by copying th
1. Querying all tables in the target librarySELECTobj.name TableName,---table nameSchem.name Schemname,---the scheme to which the table belongsIdx.rows,---A total of several rows of arraysCAST( Case when(SELECT COUNT(1) fromSys.indexesWHERE object_id=Obj.object_id andIs_primary_key=1)>=1 Then 1 ELSE 0 END as BIT) HasPrimaryKey---whether the table has a primary key fromZC_UAC.sys.objects ob
How to export data and tables from SQL Server and Oracle
1. Export and import data to a database in SQL Server1. Select the database to be transferred in the SQL Server Enterprise Manager, right-click and choose
Document directory
Windows SQL Server Security Check List
Windows SQL Server Security Check List
1. confirm that the latest patches for NT/2000 and SQL
Tags: Dex objects code and Space Pre ONS table containeSELECTTableName=obj.name,totalrows=Prt.rows,[spaceused (KB)] = SUM(alloc.used_pages)*8 fromsys.objects objJOINSys.indexes IDX onObj.object_id =Idx.object_idJOINSys.partitions PRT onObj.object_id =Prt.object_idJOINSys.allocation_units Alloc onalloc.container_id=prt.partition_idWHEREObj.type= 'U' andidx.index_idinch(0,1)GROUP byObj.name, Prt.rowsORDER by SUM(alloc.used_pages)*8 DESCSQL queries the number of record bars for
Procedure
UID
Smallint
The schema ID of the object owner.For databases upgraded from the old version of SQL Server, the schema ID is equal to the owner's user ID.Important:If you use any of the following SQL Server DDL statements, you must use the SYS. Objects directory view instead of SYS. sysobj
Uid
smallint
The schema ID of the owner of the object.For databases upgraded from legacy SQL Server, the schema ID equals the user ID of the owner.
Important NOTE:
If you use any of the following SQL Server DDL statements, you must use the sys.
are not updated. For disk-based tables, sp_updatestats (Transact-SQL) only updates UPDATE STATISTICS if the table has been modified since the last sp_updatestats (Transact-SQL). For memory-optimized tables, sp_updatestats (Transact-SQL) always generates updated statistics.[
stored in tempdb. They are automatically deleted when they are no longer used.There are two types of temporary tables: local and global, both of which have different names, visibility, and availability. The name of the local temporary table starts with a single digit;They are only visible to the current user connection; when the user is from Microsoft? SQL Server
Recently found that the database is too large, the space is not enough, so it is intended to complete the database of data cleanup, but the table is very many, one by one empty, it is really troublesome, so you want to use SQL statements to clear all the data at once. Three methods were found to clear. The database used is MS SQL
, name as Db_name from master. sysdatabases where Sid 4: Querying a table for fields and data typesSelect Column_name,data_type from Information_schema.columnsWHERE table_name = ' table name '[n]. [Title]:Select * from TableName Order by CustomerName[n]. [Title]:8. How to modify the name of the database:Sp_renamedb ' Old_name ', ' new_name '9. Copy only one table structure and not copy dataSelect top 0 * into [T1] from [T2]10. Connecting to a remote databaseSELECT * from OpenDataSource (' SQLOLE
SQL statement used to list the tables of the deadlock in the oralcle database:
============================================Select a. username, A. Sid, A. Serial #, B. id1, C. SQL _textFrom v $ session A, V $ lock B, V $ sqltext CWhere exists(Select 1From v $ Session D, V $ lock EWhere D. lockwait = E. kaddrAnd E. id1 =
In general, we can use connect to server in SQL Server Management studio to query and try to connect all available SQL Server instances in the local network, such:
In Visual Studio, you can also use tools> connect to database t
Label:--Read all table names in the library
select name from sysobjects where xtype= ' u '
-Reads all column names of the specified table
select name from syscolumns where Id= ( Select Max (id) from sysobjects where xtype= ' u ' and name= ' table name ')
gets the role of database table names and fields
in SQL Server fo
this behavior. To ensure that the partition function definition has the expected behavior for all conversational languages, it is recommended to use constants that are interpreted in the same way for all language settings, such as the YYYYMMDD format, or to explicitly convert literal values to specific styles. For more information, see Writing Internationalized Transact-
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.