Query the number of user tables in the SQL Server database

During Development today, I encountered the problem of counting the number of database tables in SQL Server 2005. So I wrote the SQL statement myself: Select count (1) From sysobjects where xtype = 'u'. Once executed, I found that the number of

How to query SQL Server versions

There are two statements: Select @ versiongo Selectserverproperty ('productversion') as productversion, serverproperty ('productlevel') as productlevel, serverproperty ('version') as edition, serverproperty ('engineedition ') as engineedition;

Usage of case in SQL Server

Case may be one of the keywords most misused in SQL. Although this keyword may have been used before to create a field, it also has more features. For example, you can use case in the WHERE clause. First, let's take a look at the case syntax. In a

C # Call the SQL Server Stored Procedure return value)

-- Return value using parameterdirection. returnvalue;Create procedure DBO.AsDeclare @ I intSelect @ I = count (*) from tbd_m_modleReturn @ IGo -- Return value using parameterdirection. output;Create procedure DBO.@ I int outputAs Select @ I = count

SQL Server & Excel)

1. query Excel Data in SQL Server: -- ===================================================== ================== select * From OpenDataSource ('Microsoft. jet. oledb.4.0 ', 'Data source = "C: \ book1.xls"; user id = admin; Password =; extended

SQL Server determines whether a table, view, or stored procedure exists

-- It can be used for real tables.If exists (select * From sysobjects where id = object_id (n' [DBO]. [Table name] ') and objectproperty (ID, n'isusertable') = 1)Drop table [DBO]. [Table name] -- It can be used for temporary tables (Note: if you use

Add SQL Server statements to favorites

If object_id ('tb') is not nullDrop table TBGoCreate Table Tb (name varchar (25 ))Insert into TBSelect 'z, Y, W, C' Union allSelect '1, 2, 3, 4' Select name = substring (A. Name, B. Number, (charindex (',', A. Name + ',', B. Number)-B. Number)From

[Arrangement] conditions for SQL Server to create an index on the View

Creating an index on a view requires three conditions:1. The view must be bound to the architecture.To do this, you must add with schemabinding to the create view statement. If you are using the Enterprise Manager, right-click the blank area in the

Analysis and Comparison of variable table and temporary table during SQL server storage

Recently, a friend of mine told me that the execution of many stored procedures in his database has timed out. let me show him why. I saw that many temporary tables and variable tables were used in his stored procedures. so I told him that I was too

Paging SQL Server Stored Procedure

/* -- Paging program implemented by stored procedures Displays page X of the specified table, view, and query result. In the case of primary keys or ID columns in the table, query the data directly from the original table. In other cases, use the

Paging statements in SQL Server databases

Two paging SQL statements The first one is the. Not in   Select Top 2 * From xy_role where id not in (select Top 4 ID from xy_role)   '2' indicates the number of information entries displayed on each page. '4': for example, if the current page

SQL Server calculates the number of weeks and the number of weeks based on the Start week.

Because SQL server does not calculate the number of weeks and the number of weeks based on the Start Week (Monday is the first day of a week or Sunday, share with you. I. Calculate the number of weeks based on the Start week: fn_getweekday Create

SQL Server saves the dataset returned by the stored procedure to a temporary table

Project requirements: In my stored procedures, you need to call the stored procedures written by others in the group and obtain the dataset returned by the Stored Procedure for joint query with my own data. This stored procedure includes input and

Difference of output returnvalue in SQL Server

1: returnvalue can only return data such as 0, 1,-1, with great limitations. In the stored procedure, the output parameter can return various types of data, which is flexible and convenient. Returnvalue is used to return the error code, and output

Considerations for SQL Server Transaction Processing

During project development, we should be familiar with database transactions, but how can we use transactions well? I would like to share some of the following notes with you: 1. For the business to be processed, the transaction operation time

Solve the problem that SQL server does not allow remote connection.

For the database system that has just been installed, if it is installed by default, it is likely that an error is reported during remote connection. The common error is: "When you connect to SQL Server 2005, this failure may occur if SQL server

SQL Server Returns XML format data

Let's look at the example. Suppose there is only one users table with two fields: ID and PWD. 1. The simplest usage: select * from users for xml auto The result is as follows: 2. The method for generating a node for each data row (Note: The default

Analyze SQL Server execution plans

--> Title: SQL Server execution plan--> Author: wufeng4552--> Date: 15:08:24 Preface: Recently, I have written some of my understanding about online planning. I have made the following arrangement to help students better understand their impressions

Ms SQL SERVER: ranking function details

Ranking function detailsSQL Server2005 is able to rank data rows in T-SQL code. The ranking function can rank each data row, providing a way to organize output in ascending order. You can give each row a unique sequence number, or give each group of

Query of SQL Server Integer fields and null Fields

The phenomenon is as follows: The inttype field is an integer.Select * from test where varchartype = 'test' and inttype =''Records with inttype 0 can be found.Update Test Set dcr_times = ''. The value of test is 0. Differences between Oracle and

Total Pages: 923 1 .... 915 916 917 918 919 .... 923 Go to: GO

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.