Alibabacloud.com offers a wide variety of articles about mcsa sql 2016 database development, easily find your mcsa sql 2016 database development information here online.
Make sure that the data type in the Code is consistent with the column type in the database
It is important to ensure that the data types at each layer of your application are consistent. For example, if the data type of a column is NVARCHAR (50), you should use the same type of local variables in code query and stored procedures.
Similarly, the ADO. NET code in the data layer should also specify the same data type and length. Why is this important? I
In web development, in addition to program SQL Injection Prevention, database security also prevents SQL injection in web development, what other aspects should I pay attention? ------ Solution ------------------ This is the most difficult question to answer. I want to break
Collation
Some may have been using SQL Server for development for some time, but they have not or seldom used stored procedures in projects. Some may think that there is no need to use stored procedures. In fact, when a project is completed in the maintenance phase, you will find that the stored procedure has brought us benefits. It is easy to modify and cannot change our applications, you only need to modi
One, add dataINSERT statement INSERT INTO TABLE_NAME (Name of field, field name) VALUES (value1,value2)1. Add values to all fields in the tableINSERT into UserInfoVALUES (1, ' xxx ', ' 123 ', ' [email protected] ', sysdate)2. Add values to the fields established in the tableINSERT into UserInfo (ID,USERNAME,USERPWD)VALUES (2, ' yyy ', ' 123 ')CREATE TABLE Userinfo1(ID number (6,0),RegDate Date Default Sysdate)INSERT into USERINFO1 (ID)VALUES (1)Second, copy the table data1. Copy all when creatin
Common Summary of MS-SQL Database Development
1. sort by strokes of the Last Name:
Select * From tablename order by customername collate chinese_prc_stroke_ci_as
2. database encryption:
Select encrypt ('original password ')
Select pwdencrypt ('original password ')
Select pwdcompare ('original password', 'encrypted pass
1. Order BY last name stroke:
Select * FROM TableName ORDER by CustomerName Collate Chinese_prc_stroke_ci_as
2. Database encryption:
Select Encrypt (' original password ')
Select Pwdencrypt (' original password ')
Select Pwdcompare (' original password ', ' encrypted password ') = 1--same; otherwise different encrypt (' original password ')
Select Pwdencrypt (' original password ')
Select Pwdcompare (' original password ', ' encrypted password
Data | database
1. Order BY last name stroke:Select * FROM TableName ORDER by CustomerName Collate Chinese_prc_stroke_ci_as
2. Database encryption:Select Encrypt (' original password ')Select Pwdencrypt (' original password ')Select Pwdcompare (' original password ', ' encrypted password ') = 1--same; otherwise different encrypt (' original password ')Select Pwdencrypt (' original password ')Select Pwdcompa
ProductName
OrderDate
1
Computer
2008-12-26
2
Printer
2008-12-26
3
Electrograph
2008-11-12
4
Telephone
2008-10-19
Now, we want to select a record from the table above that OrderDate is "2008-12-26".We use the following SELECT statement:SELECT * from Orders WHERE orderdate= ' 2008-12-26 'Result set:
OrderId
ProductName
OrderDate
1
1. Create a stored procedure
Like a data table, we need to create a stored procedure before using it. Its concise syntax is:
Create proc stored procedure name
[Parameter list (multiple parameters are separated by commas (,)]
As
SQL statement
For exampleCreate proc upgetusername
@ Intuserid int,
@ Ostrusername nvarchar (20) Output -- parameters to be output
As
Begin
-- Assign the uname value to the @ ostrusername variable, that is, the parameter to be
sets are called sub-queries. There are two types of sub-queries: One is to return only a single-valued subquery, at which point it can be used where a single value can be used, when a subquery can be considered a function that has a return value; Another is a subquery that returns a column of values, at which point the subquery can be thought of as a data table that is temporarily present in memory. Create a new department table, an employee table, and a department column number for each
XML index. To learn more about XML types, look for articles on MSDN.
There are also a variety of enhanced T-SQL index commands. Perhaps the most intriguing is the new "online" index type, which allows database administrators to perform index maintenance tasks without having to lock users out of the table. This is likely to mark the end of the situation where the datab
table1;Execute SQL ScriptSource My.sql--my.sql-------------------Insert INTO table1 (name, sex, Age, Class) VALUES (' Xiao Wang ', ' Female ', ' C + + class '); insert into table1 (name, sex, Age, Class) VALUE S (' Xiao Li ', ' Male ', ' C + + class '), insert into table1 (name, sex, Age, Class) VALUES (' Xiao Zhang ', ' Male ', ', ' Java class '); insert into table1 (n Ame, sex, age, Class) VALUES (' pock ', ' female ', ' C + + class '), INSERT into
The following code imports all excle data from the C:\cs\ folder into the SQL databaseDeclare @query VARCHAR (1000)DECLARE @max1 intDECLARE @count1 intDECLARE @filename varchar (100)Set @count1 =0CREATE TABLE #x (name varchar (200))Insert #x exec (' Master.dbo.xp_cmdshell ' dir c:\cs\*.xls/b ')Delete from #x where name is nullSelect IDENTITY (int,1,1) as ID, name into #y from #xdrop table #xSet @max1 = (select MAX (ID) from #y)While @count1 BeginSet @
This article discusses some of the new features of SQL Server 2005 that will help you create a new type of database application.
The way database development is changing as Microsoft SQL Server, the release of Beta 2, is released. As a
Make sure that the data type in your code is consistent with the type of column in the database
It is important to ensure that the data types of your application are consistent across tiers. For example, if a column has a data type of nvarchar (50), you should use the same type of local variable in the code query and stored procedure.
Similarly, the Ado.net code in the data tier should specify the same data type and length. Why is this important? Beca
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.