look at an example:
Copy Code code as follows:
Use DEMODB2008R2
Go
--Table used to store the encrypted data
--For the purposes of this recipe
CREATE TABLE #SecretInfo
(MySecret varbinary (max) not NULL)
Go
INSERT #SecretInfo (MySecret)
SELECT Encryptbypassphrase (
' My Password Used to Encrypt this String in 2008. ',
' I put the company's
SQL Server FAQs and Solutions
Preface
In QQ groups, groups, and forums, I often help my friends who use SQL Server databases to solve problems. However, some of the most common and basic questions are asked every day, I don't want to answer any more questions. Simply sort out these questions and ask someone to directly
security identity (SID). --return login ID, parameter is login Name
suser_id([' Login '] )
--return to login Name, parameter is login ID,
Suser_name([Login_id])--return sid (Security identification), parameter is login Name
Suser_sid([' Login '] [, Param2] )
--return login Name, parameter is SID
suser_sname([SID]) The difference between 4,sid and ID When creating a SQL Server login, from th
be a single field, not a combined field.
Only one full-text index is allowed per table. To create a full-text index on a table, the table must have a unique and non-Null column. You can create full-text indexes on the following types of columns:char,varchar,nchar,nvarchar,text,ntext, image,XML,varbinary , and varbinary (max), which allows full-text search of
* Description: copy a table (only copy structure, source table name: a new table name: B)Select * into B from a where 1
* Description: copy a table (copy data, source table name: A target table name: B)Insert into B (a, B, c) Select D, E, F from B;
* Description: displays the article, Submitter, and last reply time.Select a. Title, A. username, B. adddate from Table A, (select max (adddate) adddate from table where table. Title = A. Title) B
* Descri
SQL Server data table field custom Custom Data Format method, SQL Server
This document describes how to customize the Custom Data Format of SQL Server data table fields. We will share this with you for your reference. The details
. SQL Server 2005 or later can be replaced by: Update Set Content=cast(replace(castasnvarchar(max)),@ S,@dastext) 4. Performing Remote database operations When we configure the linked server, we can directly access the remote database table, as follows Insert into LNK_ServerB_DatabaseB.DatabaseB.dbo.TableB
... Updat
Excel|server
Basic ways to import/export Excel from SQL Server
/*=================== Import/Export Excel basic methods ===================*/
From the Excel file, import the data into the SQL database, very simply, using the following statement directly:
/*============================================================
Tags: ima binary is com LAN automatic tin application OKThere are two characteristics of data in a computer: type and length. The so-called data types are the types of data that are divided by the way data is represented and stored.Each variable, parameter, expression, and so on in SQL Server has a data type. The data types provided by the system are divided into several categories, as shown in table 4-2.Of
shrinkdatabase (N ' AdventureWorks ', ten, truncateonly)
Reorganize Index (re-organizing indexes)
Re-organize indexes in SQL Server database tables and views. By using the Re-organize index task, a package can rearrange indexes in a single database or in multiple databases. If this task only organizes indexes in a single database, you can select the view or table whose indexes you want the task to rearrang
-length binary data type. (3) Image: A variable-length binary data type. Note : ntext, text, and image data types will be removed in future versions of SQL Server, using nvarchar (max), varchar (max), and varbinary (max) instead.
Brief introduction
0 "style=" box-sizing:border-box; Outline:none; Margin-right:auto; Margin-left:auto; max-width:1600px; width:761.391px; " > This article describes how to transfer logins and passwords between Microsoft SQL Server 2005 instances on different servers.
For more information about how to transfer logins and passwords between other
Figure 1 wins the 10 Statement: SQL Server database Summary
A rough summaryAfter a period of study, I also had some knowledge about databases.Databases are basically composed of tables, relationships, and operations. For Beginners, the first thing to learn is:
1. How does a database store data?Table, constraint, trigger2. How does a database operate data?Insert, update, delete T-
or alter table is null, this value will replace the default null value of this data type.
Type
Tinyint
Physical storage data type.
Printfmt
Varchar (255)
Retained.
Prec
Smallint
The precision level of this data type.
Scale
Tinyint
Decimal places of this data type (based on precision ).
Sysusers
Top
Every Microsoft? Windows users, Windows groups, Microsoft SQL
Unicode)
ntext
The maximum length is 1,073,741,823 characters. (variable-length Unicode)
Binary data type:
Data Type
Description
Binary
8000 bytes for maximum length (fixed-length binary data)
varbinary
The maximum length of 8000 bytes. (Variable-length binary data)
varbinary (
supports enum, and set type, SQL Server does not support2 MySQL does not support nchar,nvarchar,ntext type3 MySQL increment statement is auto_increment, and MSSQL is identity (a)4 MS SQL Default the default value for table creation statements is ((0)), while in MySQL it is not allowed with two brackets5 MySQL needs to specify the storage type for the tableThe 6
2: In the dialog box, select:Step 3: Select in "Advanced":Step 4: Save the script and run the script in SQLServer2005. Detailed steps can be seen: http://bbs.csdn.net/topics/390438560?page=1#post-394316973 in the 13 floor of the reply, there is step 5: Through the "task" → "Import data", Importing the data from 2008 to a library created using the script is done as follows:Method Two: Using the system's own stored procedure implementation:sp_dbcmptlevel--Set Some database behavior to be compatib
actual content of the request.The created task must first execute the request, and the database engine assigns a worker to handle the request.Worker (Workers)Worker (Workers) is a thread of SQL Server line constructor, some workers (Workers)/worker threads in SQL Serveris created when initialized, while others (Workers) are created on demand, when the number cre
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.