You cannot create an identical user and mapping the user to the database, and you cannot delete the database user: DemoUser.
Please run the following script and then you can delete the user: DemoUser. Then create the user (DemoUser.) and mapping to
1, scene: According to the student number query, return the student in the class of all students. The page that supports paging, custom sorting, and the student number where the result set is automatically positioned to the query criteria.
Copy Code code as follows:
CREATE PROCEDURE [dbo]. [Up_pager]
@table varchar (2000),--table name
@col varchar (50),--Paging by this column
@orderby bit,--sort, 0-order, 1-Descending
@collist varchar,--The list of fields to query, *
Copy Code code as follows:
-Determine if some of the fields are empty
--case
Select Case ' field name ' is null then ' \ n ' else convert (varchar (20), ' Field name ') End as ' NewName '
Select Case when NULL is NULL then ' \ n ' else
1. Expand the server object--> linked server--> right click "New Linked Server"
Note: You must be logged on as a database administrator (usually the SA account) before you can create a linked server
2. Enter the IP of the linked server
3. Set
Microsoft SQL Server Management Studio is a client tool for SQL Server, which I believe you all know. I don't know how the guys use the import data, but I've met them recently. The main reason is that there is no permission to the remote database
Let's take a look at the following examples:
Table tables
Field 1 Field 2ID Name1 A2 b3 C4 C5 b
The library structure is probably like this, this is just a simple example, the actual situation will be much more complicated.
For example, I would
Copy Code code as follows:
--Member Table
If object_id (' UserInfo ', ' u ') is not null
drop table UserInfo
Go
CREATE TABLE userinfo (userid int primary key,user_tegral int,level int)
Insert INTO UserInfo Select 1,0,0
Go
--Membership
version One: comparing by separator
Algorithm idea: Intercept the search string loop by separator and compare the characters to be searched
Copy Code code as follows:
Use [Fly]
Go
--Parameters: @inStr to search strings, @fndStr
Create DATABASE Myindexdemo
Go
Use Myindexdemo
Go
CREATE TABLE ABC
(
A int NOT NULL,
B Char (10),
C varchar (10)
)
Go
INSERT INTO ABC
Select 1, ' B ', ' C '
Union
Select 5, ' B ', ' C '
Union
Select 7, ' B ', ' C '
Union
Select 9, ' B ', ' C
You must have had such trouble, the same table, different database, join you can't perform select InsertThen you definitely need a stored procedure that needs to be passed in and will give you the INSERT statement that generates the data.Of course
For a newly added record, you get the value of the automatic identity column for the new record, in two ways:1. Use the OUTPUT keyword in insertINSERT into table_name (COLUMN1,COLUMN2,COLUMN3)OUTPUT Inserted.id--Returns the value of an automatically
If we insert a value in the identity column, for example:
Copy Code code as follows:
Insert member (ID,USERNAME) VALUES (' admin ')
The error message is returned in the Query Analyzer:[Plain]Reference contentServer: Message 544,
Table types can be used in stored procedures for bulk additionsTable type definition:
Copy Code code as follows:
The CREATE TYPE dbo. Subcardtable as Table
(
[SC_ID] [varchar] (50),
[ZHUKAINFO_ID] [varchar]
Instead of the bool type in SQL Server, a bit type is used to represent the bool value, presumably to conserve storage space.
However, to achieve the reverse operation seems to be troublesome to write, such as the following statements are not
SQL SERVER formula for calculating distances based on map latitude and longitude
Copy Code code as follows:
Go
--Create latitude and longitude distance calculation function
createfunction [dbo]. [Fngetdistance]
--latbegin begins
There are two extended stored procedures in SQL Server that implement the scanf and printf features, and use them appropriately to simplify the SQL code significantly when extracting and stitching strings.
1, xp_sscanf, use it to decompose a
There are three keywords in SQL Server that can modify comparison operators: All, any, and some, where some and any are equivalent.
the official Reference documentHttp://technet.microsoft.com/zh-cn/library/ms187074%28SQL.90%29.aspx
They work
E Packing directory Create a new Excel file Aa.xls and test the following code
Copy Code code as follows:
Use tempdb
Go
if (object_id (' udf_getexceltablenames ') is not null)
Drop function dbo. udf_getexceltablenames
Go
Create
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.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service