Grammar
REPLACE (' String_expression1 ', ' string_expression2 ', ' String_expression3 ')
Parameter description
' String_expression1 '
The string expression to search for. String_expression1 can be either character data or binary data.
' String_expression2 '
The string expression to find. String_expression2 can be either character data or binary data.
' String_expression3 '
The string expression to replace. String_expression3 can be either character data or binary data.
Popular understanding is
Recently do data transfer, due to misoperation, in the system table master tables created n multiple tables is really impossible to deleteFind the following ways to share---Specify the tables in the database to be deleted use mastergodeclare @sql varchar (8000), @TableName varchar () BEGIN DECLARE cur cursor for Select Name from sysobjects where xtype= ' P ' and crdate>= ' 2015-03-31 10:33:14.663 ' open cur fetch next fro M cur to @TableName while
Tags: combination additional src number Eve sel over script RosBegin:In testing, in order to simulate orders, there is a requirement for the DBA, how to quickly batch generate orders through the background database script. AnalysisStanding in the database perspective, bulk generate orders, which is the bulk of the row data in the table. In SQL, two table (e.g. A,
Tags: completion note method images database PNG SQL HTML import ExcelSQL Server table and Excel data bulk copy methodOne, SQL Server table data copied to ExcelMethod:1. Create a new query and read the table data using SQL stateme
Taking advantage of the remainder of the previous article, we continue to study how to dispatch multiple packages in SSIS, does it require a package configuration scheduler? Obviously not, so let's talk about how to schedule all of the jobs in the SSIS application in bulk, this article only covers a basic logical process and simple testing.1: Publish SSIS PackageDispatch package, we need to first publish the SSIS package to
Label:Run the following script to build the test database and table.--Create databasecreate database bulktestdb;gouse bulktestdb;go--int primary KEY, UserName nvarchar (+), Pwd varchar (+)) Go--int, UserName nvarchar (+), Pwd varchar (+))View CodeUse the simplest INSERT statement to iterate through the 1 million data.Select COUNT(*) frombulktesttable;--Delete from bulktesttable;DECLARE @id INT,@username NVARCHAR( +),@pwd varchar( -)SET @id=1SET @user
Specific steps such as:1, first drag a foreach control in the SSIS Toolbox, and select the corresponding folder, matching the corresponding file, as follows2. Create variables to receive3. Drag into a data Flow task, and then drag it into an Excel source and OLE DB Destination, respectively, with the following settings4. Edit the Excel Connection Manager, here will use a foreach variable to replace the Excel file that you just selected, the Connection manager's properties to set the mapping meth
These days of practice. Come across a little bit of a problem. For example, I have scores initialized in the score table for all 0. So now I want to randomly generate 100 or less data to write in, how should I do it? You can use a few small functions.One is rand ()It is responsible for generating random numbers.One is cast ()It is responsible for type conversions.One is round ()It is responsible for rounding the values. In addition to this, floor () represents the downward value. and ceiling ()
Label: UPDATEMaindataSETContent=
REPLACE(CAST(Content as VARCHAR(8000))
, 'XM00000137'
, 'XM00000078')
WHERE [Key]
inch(SELECTMd_key fromIndex_md_inprojectWHEREMd_inproject= 'XM00000137') Using the Replace function, the format is: Update [table name ] Set [Fields field name ] = Replace ([Fields field name ],' replaced original content ',' To be replaced by the content ' Of course, if the field type that you want to replace directly is the text type, it will be an error ("paramet
--Modify the schema in bulk. All tables with the name Xjadminatt are modified to dbo----Copy the result of the execution to the command line and execute the command--Declare @namesysnameDeclareCsr1cursor for Selecttable_name frominformation_schema. TABLESOpenCSR1FETCH NEXT fromCsr1 into @name while(@ @FETCH_STATUS=0) BEGIN SET @name='Xjadminatt.' + @name Print 'ALTER SCHEMA dbo TRANSFER' + @name Fetch Next fromCsr1 into @name END
OpenRowset usage can refer to the MSDN
Http://technet.microsoft.com/zh-cn/library/ms190312.aspx
If there are many files, it is recommended to use the program to pour
Copy Code code as follows:
if (object_id (' T_bulkresult ') is not null)
drop table T_bulkresult
CREATE TABLE T_bulkresult (name varchar (1000), data image)
Go
DECLARE @d varchar (1000)
Set @d = ' c:\test\ '
CREATE TABLE #tb (FName varchar (1000), d int, F int)
INSERT INT
] [nvarchar] (a) not null,[detailage] [i NT] not null,[createtime] [datetime] is not NULL);Dbo. F_rtnstrbysplitindex is a custom scalar-valued function that returns the string corresponding to the first number of delimiters, such as dbo. F_rtnstrbysplitindex (' Jack|lilei|tom|nike ', 3) returns TomHere is the creation of the functionCreate function [dbo]. [F_rtnstrbysplitindex] (@procStr nvarchar (max), @splitStrIdx int) returns nvarchar (+) asbegindeclare @rtnStr nvarchar (+) DECLARE @ Currents
SQL Server is a bit difficult, and the tools that come with it do not work. The verified data can be done by writing a stored procedure.The stored procedures are as follows:SET quoted_identifier OFF Goset ANSI_NULLS on goif exists (select 1 from sysobjects where id=object_id (' Bicashyoutputdata ') and xtype= ' P ') drop procedure bicashyoutputdata; Gocreate procedure dbo. Bicashyoutputdata (@tablename varc
SQL Server table and Excel data bulk copy method (resolved)
SQL Server table data Copy to Excel (method)
1, the new query, using SQL statements to read the table data
2, then, select data, right button, copy (also can be clicke
Tags: SQL Server database queriesRecently has been studying the blog, in fact, is now a popular self-media, it is interesting that the netizens have written their own blog, the establishment of a small station, and now went to the platform for others to work free, but also enjoy themselves, do not know what the situation.Blog information:Topics: Learning topics related to reading notes.Web site: Use a. NET
Editor: Like our server to use tools to the log 1M programming, not too troublesome to see the manual method:
1: Delete Log
1: Detach Database Enterprise Manager-> Server-> database-> right key-> Detach database
2: Delete log file
3: Additional database Enterprise Manager-> Server-> database-> right key-> attached database
This method generates a new log wit
Inserting a single piece of data into SQL Server uses the INSERT statement, but if you want to bulk insert a bunch of data, looping through insert is inefficient and results in a system performance problem with
Tags: ring using har cell storage traints Batch ref ACERecently modified the database table structure, the data synchronization problem, found that a lot of data has been modified, but filtered through the view or the original data, so suspect should be the view cache data, in the garden to find the following blog post, here to make a record memo. original link:http://www.cnblogs.com/yashen/archive/2004/12/23/81000.html This is often the case when we use S
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.