• Usage examples of if else in sqlserver stored procedures


    Now we need to insert data into table B through programming, but it is not allowed to assign null value to int type in the program. If it is not assigned, it defaults to 0.To solve this problem, if else of the stored procedure is used. The following is the complete stored procedure. Code example: […]

  • SQLSERVER database syntax Encyclopedia


    –Data operationSelect — retrieve data rows and columns from database tablesInsert — add a new data row to the database tableDelete — delete data rows from database tablesUpdate — update the data in the database table–Data definitionCreate table — create a database tableDrop table — delete a table from the databaseAlter table — modify database […]

  • DDL operations of MSSQL monitoring database (create, modify, delete stored procedures, create, modify, delete tables, etc.)


    Foreword: sometimes, a database has multiple accounts, including database administrators, developers, operation and maintenance support personnel, and many accounts may have relatively large permissions, such as DDL operation permissions (create, modify, delete stored procedures, create, modify, delete tables, etc.). If there are many accounts, it will be quite troublesome to manage and easy to cause […]

  • How to control trace marks in sqlserver


    What is the tracking mark? For DBAs, mastering trace flag is one of the necessary conditions to become a master of SQL server. In most cases, trace flag is just a trick to take the wrong side of the sword, which is unnecessary, but in many cases, using these flags can let you better control […]

  • Some differences between PostgreSQL and sqlserver


    Conditional query – fuzzy matching The fuzzy matching like of PostgreSQL and SQL server is different. The like of PostgreSQL is case sensitive, and SQL server is not. The tests are as follows: //Construct data SQL create table t_user ( id integer PRIMARY KEY, name varchar(50) not null, code varchar(10) ); insert into t_user values(1,’Zhangsan’,’77771′); […]

  • Example of sqlserver calculating distance difference based on longitude and latitude of map


    SQL server calculates the distance formula according to the longitude and latitude of the map Copy codeThe code is as follows: go –Create longitude and latitude distance calculation functionCREATEFUNCTION [dbo].[fnGetDistance] –Latbegin start longitude–Lngbegin start dimension(@LatBegin REAL, @LngBegin REAL, @LatEnd REAL, @LngEnd REAL) RETURNSFLOAT AS BEGIN –Distance (km)DECLARE @Distance REAL DECLARE @EARTH_RADIUS REAL SET @EARTH_RADIUS = […]

  • Introduction to sqlserver table types and table variables


    Table types can be used in stored procedures to batch add table type definitions: the copy code is as follows: create type dbo SubCardTable as table  (       [SC_ID] [varchar](50),       [ZhuKaInfo_ID] [varchar](50),       [Project_KeyName] [varchar](50),       [SC_CardNumber] [varchar](50),       [Statues] [int] DEFAULT 0,       [SC_AddTime] [datetime],       [SC_AddPerson] [varchar](50),       [SC_Money] [int],       [MainCardReceiveIntegral] […]

  • Two methods to migrate access database to SQLSERVER database (picture and text explanation)


    Access2000 file Open with Access2007 and migrate to SQLServer2005 Open the database tool of Access2007 Method 1: use the database migration tool provided with Access2007 1. Open the database Migration Wizard of Access2007 2. Click sqlserver to open the upsizing Wizard dialog box 3. Select new database 4. Enter the computer name. My local computer […]

  • Summary of sqlserver performance tuning experience


    I believe that many friends, whether in development, architecture or DBA, often hear the word “tuning”. Talking about “tuning” may make many technicians passionate, and may also make many people feel distressed. Of course, many people are dismissive of this, because not everyone has a large project, and not everyone has high performance requirements for […]

  • Experience summary of large-scale application solutions of SQL Server database


    With the wide popularization of Internet applications, the storage and access of massive data has become the bottleneck of system design. For a large-scale Internet application, millions or even hundreds of millions of PVS every day undoubtedly cause a very high load on the database. It causes great problems for the stability and scalability of […]

  • On load balancing of SQL Server


    As of SQL Server 2008 R2 version, Microsoft has not launched the official load balancing component, and can only DIY through other technical features of SQL server or using third-party components. In previous articles, Xiaobian also summarized some common “SQL Server Cluster”, “SQL server data synchronization”, “SQL server failover” And other related implementation skills. I […]

  • [latest and detailed] SQL Server 2019 installation tutorial


    [latest and detailed] SQL Server 2019 installation tutorial Introduction: today, we are working on a new computer environment, which is very important for me Net programmer, it must be inseparable from the installation of SQL server. I didn’t find a very detailed tutorial on the Internet, so I decided to write another one myself. Let’s […]