Database
wbing520
这个作者很懒,什么都没留下…
展开
-
SQL Syntax - SQL FUNCTIONS
1. SQL Aggregate Functions (聚合函数)原创 2014-04-11 01:46:24 · 625 阅读 · 0 评论 -
Copy database via backup and restore
When copying the database using wizard in SQL server is failed, I use the following method to copy the database successfully.--backup the databasebackup database test1 to disk='c:\test1_full.转载 2016-03-10 11:20:27 · 506 阅读 · 0 评论 -
LeetCode Database Problems
[175] Combine Two Tables[176] Second Highest Salary[177] Nth Highest Salary[178] Rank Scores[180] Consecutive Numbers[181] Employees Earning More Than Their Managers[182] Duplica原创 2015-09-16 09:57:59 · 562 阅读 · 0 评论 -
Rename the database name sql
use masterGOdeclare @oldname varchar(50) = 'LldName'declare @newname varchar(50) = 'newName'exec ('Alter database '+ @oldname+ ' set single_user')exec ('sp_renamedb ' + @oldname + ' , '+ @newna原创 2015-05-07 21:54:22 · 725 阅读 · 0 评论 -
Insert data into a table using table variables and cross join
Declare @SSRSreportIDTable TABLE( ID int)Declare @UserNameTable Table( username nvarchar(50))INSERT INTO @SSRSReportIDTable Select SSRSReportID FROM SSRSReport WHERE SSRSReport.[SSRSRepor原创 2015-04-29 22:20:23 · 575 阅读 · 0 评论 -
Country Code
The Script to create the countries and codeALTER TABLE [GeoCity]ADD [CountryName] NVARCHAR(128) NULLGODELETEFROM [GeoCity]WHERE [Region] IN ('')GOSELECT 'Afghanistan' [CountryName],'Ka原创 2014-10-04 00:57:41 · 2022 阅读 · 0 评论 -
SQL Get the primary key name/ drop pk/ add pk
SELECT [Name]FROM [sys].[key_constraints]WHERE [type] = 'PK'AND OBJECT_NAME(parent_object_id) = N'PropertyChannel' ALTER TABLE [dbo].[PropertyChannel]DROP CONSTRAINT [PK_PropertyChannel_ID原创 2014-09-26 00:58:28 · 874 阅读 · 0 评论 -
SQL Server Insert data into table
1. Insert only one row of data2. Insert several rowsINSERT INTO [PropertyChannel] (PropertyId, ChannelId)SELECT 1, 2UNION ALLSELECT 1, 3UNION ALLSELECT 2, 1UNION ALLSELECT 2, 2UNION AL原创 2014-09-19 02:55:28 · 948 阅读 · 0 评论 -
SQL Syntax -- More about SQL
1. SQL SELECT INTO Statement-- copy one table into a new tableSELECT *INTO newtable [IN externaldb]FROM table1-- copy only columns into the new tableSELECT colName(s)INTO newtable [IN ext原创 2014-04-12 13:10:45 · 802 阅读 · 0 评论 -
SQL Syntax - more about SQL
1. SQL SELECT INTO Statement-- copy one table into other tablesSELECT *INTO newtable [IN externaldb]FROM table1原创 2014-04-12 03:55:11 · 885 阅读 · 0 评论 -
SQL Syntax - Some Useful Keywords
1. SELECT TOP Clause--TOP used to specify the number of records to return,SQL SERVERSELECT TOP number|percent colNameFROM tableName原创 2014-04-11 01:07:55 · 656 阅读 · 0 评论 -
SQL Basic Statement(INSERT/DELETE/UPDATE/SELECT)
4. SQL Basic Statement-- SQL SELECT SyntaxSELECT column_name, column_name, *FROM table_name;原创 2014-04-11 00:40:57 · 990 阅读 · 0 评论 -
SQL Basic Syntax Principles
1. What is SQLSQL is for Structured Query Language. It used原创 2014-04-11 00:10:47 · 532 阅读 · 0 评论 -
SQL Syntax -- Joins
SQL Joins are used to combine ROWS from two or more tables. Join operator is原创 2014-04-11 01:32:21 · 785 阅读 · 0 评论 -
Dynamical SP with Entity Framework
Finally, the issue that the dynamical Sp not working on Entity framework is fixed by putting 'SET FMTONLY OFF' in the beginning of the stored procedure. When entity framework tries to retriev原创 2016-12-16 03:22:16 · 393 阅读 · 0 评论