Recently, I have used the operation of SQL Server database to do something. Well, really long time did not see, to this database is unfamiliar to the pole, even the simplest how to set an ID primary key, let it with the insertion of data, automatic growth ID value settings are forgotten, online check a bit, many people say the use of code, like I want to be diffe
at the IAM information, as follows:Slot 0 = (1:79) Slot 1 = (1:89) Slot 2 = (1:90)Slot 3 = (1:93) Slot 4 = (1:94) Slot 5 = (1:109)Slot 6 = (1:110) Slot 7 = (1:114)Iam:extent Alloc Status Slot 1 @0x592ec0c2(1:0)-(1:176) = Not allocated(1:184)-(1:192) = Allocated(1:200)-(1:376) = Not allocatedThe Highlight section indicates the partition information for IAM, and the first data page pointer points to the page. This is consistent with the first_page values we have queried . An IAM page corresponds
Label:The following code has been found on the Internet:DECLARE @Pk varchar (100);Select @Pk =name from sysobjects where parent_obj=object_id (' table name ') and xtype= ' Pk ';If @Pk is not nullBeginEXEC (' Alter table name Drop ' + @Pk)--Delete the primary keyEndThe point here is that the table Sysobjects,sysobjects table is a system table, each object created in the database (constraints, defaults, logs, rules, stored procedures, etc.) in the table
This morning, I learned about the use of primary and foreign keys in SQL Server and how to establish the connection between primary key and foreign key.In the afternoon, I learned how to apply the subquery inside SQL Server, and also practiced the use of functions (String fu
); }
} Report 1: Create the main report Master.jrxml The first new two parameters in Master.jrxml, the name is the red label in the code above Cpid is the primary key used to write SQL, and Subreport_dir is the address used to connect the subreport Start writing Master.jrxml SQL statements such as After writing the
Label:Soft code generator in SQL Server, the generated code incorrectly identifies a unique index as the primary key.After you decompile the source code, you find that the SQL condition is incorrect, and now fix the bug.FIX: Replace the "Maticsoft.DbObjects.dll" in the attachment with the relevant files in the installation directory. (Please do a backup before re
When the SQL Execution fails, the prompt is displayed again: ora-02429: Unable to delete the index that is used to force a unique/primary key, sqlora-02429
SQL 1: select segment_name, partition_name, tablespace_name from
-- The tablespace that displays the primary
How to obtain the primary and foreign key relationships in SQL Server 2008:
Select object_name (con. constid) 'relational name ',Object_name (SF. fkeyid) 'Primary key table ',Fcol. Name 'Primary
Delete data is constrained when there is a primary foreign key relationship between tables, add, delete failsSolution, we can first set the check of the primary foreign key relationship to shut down → then delete the data → then open the constraintQuery the statement that turns off all foreign
Tags: style io os ar strong art SP CTI on1. Write scalar value function iconvert2stringCREATE FUNCTION iconvert2string (@N int,@f INT) RETURNS varchar (ten) Asbegindeclare @M intdeclare @L0 intdeclare @CH VARCHAR (10) DECLARE @ST VARCHAR () Select @CH = "Select @ST =convert (VARCHAR), @N) Select @ST =rtrim (@ST) Select @L0 =len (@ST) Select@m=1while (@mDescription: The parameter @f is the length of the variable part after the string. 2. Write a scalar-valued function that returns a
Joint primary key (joint index) Index Analysis in SQL Server (MySQL)
Some people have recently asked this question, but they have not studied the specific use logic of the joint index before. They have read many articles and obtained some conclusions after tests.
Test environment: SQL Server 2008 R2
The test result is
executes an insert operation to another table with an IDENTITY column, @ @IDENTITY returns the value generated by the trigger. If the trigger inserts a table that does not contain an IDENTITY column, then the @ @IDENTITY will be null. If the insert operation fails, the @ @IDENTITY value will still increase, so the IDENTITY does not guarantee the continuity of the data.@ @IDENTITY is a global variable for the current connection and is valid only for the current connection. That is, if the connec
Label:Establish dept and EMP Tables, and set the foreign keys of the EMP table with the dept_id in the Dept table CREATE TABLE Dept
(
dept_name nvarchar () not NULL,
dept_address nchar (+),
dept_id int constraint pk_ Dept PRIMARY key --dept table's primary key, named Pk_dept
)
CREATE TABLE emp
(
emp_name n
Label:One. Turn off automatic identity column auto-growth:The command required for the operation is: SET Identity_insert [table][on| OFF] After the parameter is "on", means: Open the Identity column manual insertion function. Once the command execution succeeds to insert data into the table thereafter, the automatic identity column will not grow automatically, and the contents of this column need to be inserted manually. Of course, after the data addition operation is completed, we need to turn
Tags: val operation data operation IAR Comma ICA multiple span insertSometimes data operations are required, and data is updated if there is data, and no data is inserted. The previous practice is to query, and then based on the query results to judge, to perform the INSERT or update operationThere is actually an on DUPLICATE KEY UPDATE syntax that allows you to
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.