The following methods can be used to quickly generate a batch of data
if (object_id (' t ') is not null) drop table T
Go
CREATE TABLE t (ID int identity (1,1), name varchar (40))
Go
Insert into T (name) select NEWID ()
Go 10
SELECT * FROM t
/*
1 18
For repeated row deletion problem, the Internet is difficult to find the right answer, ask a lot of questions, but in the search engine cursory look at the previous record there is no solution.
In fact, this problem can be very gorgeous solution.
1,
First, use C # to convert image to byte[] and insert the database:
1.1 Convert Image control image to stream:
Copy Code code as follows:
Private byte[] Pictoarray ()
{
Bitmap BM = new Bitmap (picbox.image);
MemoryStream ms =
1. Using management Studio Express, log in with Windows authentication, select the SQL Server name, right-click the mouse to select Properties, and in the Server Properties Options page, select Security to change server authentication from Windows
Create a linked server. Linked servers allow users to distribute heterogeneous queries to OLE DB data sources. Create a link using sp_addlinkedserverServer, you can run distributed queries against the server. If the linked server is defined as an
What is the difference between a SQL Server server and a server group
A server group is just a logical concept, similar to a group of colleagues, friends, and family members in a class or QQ. There are n students under the general class. Students
First, the problem description:
1. In SQL Server, the Replace function is not allowed to be replaced by the Ntext/text/image field;
2. With convert field conversion, you can convert the ntext field to varchar (8000) and replace it with the Relpace
Recently there is a project that needs to check whether a character field value is a number, because the data row is massive, so need to pass through the SQL statement to screen, here to make a memo.
The function used is isnumeric, and the concrete
Recently interviewed an interview problem, suddenly a bit confused, only to say the idea, and then Baidu a bit, sorted out the idea, so record down, convenient to learn later. (Please refer to the annex for the test questions)
Related Data tables:
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.
1, check the integrity of the database
Copy Code code as follows:
DBCC CHECKDB (TEST)
--increase speed by adding tablock
DBCC CHECKDB (test) with TABLOCK
2, database Rename, modify recovery mode, modify user mode
Copy
MS SQL SERVER obtains information such as the current database file and is available for multiple versions:
Copy Code code as follows:
SELECT dbf.file_id as Fileid
, dbf.name as [FileName]
, S.filename as Filelocation
, CAST (dbf.size/1
Create a query that executes the following statement generation function fn_getpy
Copy Code code as follows:
--Generate phonetic first code
CREATE function fn_getpy (@str nvarchar (4000))
Returns nvarchar (4000)
--with encryption
As
One day, when debugging a program, suddenly found that after attaching a database, want to add a relational table, the result came out the following error:
The database diagram support object cannot be installed because the database does not have a
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
Normally, an appropriate index is established on the SQL Server server for a table with a high frequencyThis can greatly improve the data retrieval speed of the database itself, the method of establishing the index is not elaborateIf you need to
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
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
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.