C # connect to SQL ServerThe introduction of C # Connection database, this article summarizes the more comprehensive. http://blog.csdn.net/candy1232009/article/details/7654927For C # connectivity to MS SQL Server, use SqlConnection primarily. The
In SQL Server (which should be said to be in all database products), create a resource such as a table, a view, and a stored procedure to determine whether the resource being created already exists In SQL Server, you can generally find the results
1. String manipulation functionsSuppose @a= ' abc789 '1.charindex returns the starting position of a character or string in another stringCHARINDEX (' B ', @a)--Results: 22.substring returns part of a character, binary, text, or image expression
How to determine the existence of a table or database in SQL Server, but in actual use, you need to determine the status State bit:Some of these status bits can be set by the user using sp_dboption (read only, dbo use only, single user, and so on):1
We have compiled some common SQL Server statements, which is also a number of basic SQL database courses, including the creation of tables, add columns and so on, thank you have been the fire of support and help, we will continue to work!The
--SQL SERVER determines if there is a trigger, stored procedure--Determine the storage process and delete if it existsIF (EXISTS (SELECT * from sysobjects WHERE name= ' procedurename ' and type= ' P '))DROP PROCEDURE procedurename--Judgment trigger,
--Delete primary keyALTER TABLE name drop constraint primary Key name--Add primary keyALTER TABLE name add constraint primary Key name primary key (field name 1, field Name 2 ...)--Add a primary key for a nonclustered indexALTER TABLE name add
--Tableif exists (SELECT * from dbo.sysobjects WHERE id = object_id (n ' [monthly_budget_work] ') and OBJECTPROPERTY (ID, n ' isusertabl E ') = 1)drop table [Monthly_budget_work]GO--functionif exists (SELECT * from dbo.sysobjects WHERE id =
Below you introduce SQL under the use of a variety of resources to determine the existence of the code, the need for friends can refer to, I hope you learn SQL functions and databases can be helpful.Whether the library existsif exists (select * from
Related OBJECTPROPERTY may refer to: http://msdn.microsoft.com/en-us/library/ms176105.aspx
Mistakes are unavoidable in the development process. In order to correct errors and normalization. You can use MS SQL Server's system stored procedures
1, to determine whether the data table exists
Method One:
Use Yourdb;
Go
if OBJECT_ID (n ' tablename ', n ' U ') are NOT null
print ' exists '
else
print ' does not exist '
For example:
Use Fireweb;
Go
if object_id (n ' temp_
How to determine the presence of a table or database in SQL Server, but in actual use, you need to determine the status State bit:Some of these state bits can be set by the user using sp_dboption (read only, dbo use only, single user, and so on):
1
Copy Code code as follows:
--Way One
if exists (SELECT * from dbo.sysobjects WHERE id = object_id (N ' [dbo].[ Usp_procedurewithtransaction_demo] and OBJECTPROPERTY (ID, N ' isprocedure ') = 1)
drop procedure [dbo].
Backup | recovery | data | database
Use SQL language to implement backup/restore functions of the database
Embodies four of the knowledge points in SQL Server:
1. Get the default directory on the SQL Server server
2. Use of Backup SQL statements
server| Server | Issues-Data on a scheduled synchronization server (synchronization of data modifications on the server to local)
--Example:
--Test environment, SQL Server2000, remote server name: Rserver, username: ruser, password: rpwd,
Testing
In SQL Server, how can I tell if a SQL Server table exists? Here is a detailed description of the method, for your reference, to help you understand the SQL Server table a little bitHow to determine the existence of a table or database in SQL Server,
Original: SQL Server system table sysobjects introduction and useAll information about the SQL Server database is stored in its system table. I wonder if you have spent more time checking the system tables because you are always busy with user forms.
SQL to view the size of each table in the database Author : CC Abba 2014-6-17 in Daily SQL in the operation of the database, how to quickly query the size of the data in the tables in the database. There are two ways to refer to this: The
--Delete primary Key Alter TableTable nameDrop constraintPRIMARY Key Name--Add primary Key Alter TableTable nameAdd constraintPrimary Key NamePrimary Key(field name 1, field Name 2 ...)--to add a primary key for a nonclustered index Alter TableTable
-- =======================================================================================================--Description: Updates the size of the tables in the query database and stores the results in the data table-- =================================
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.