sql-server-2008-r2

BCP from One Table to Another table in different servers in SQL Server 2008 R2

泄露秘密 提交于 2020-01-15 07:49:49
问题 I have two different servers. I need to transfer the data from One Server table to another server table (both are on same structure) using either BCP or using BULK INSERT . I need to do this on the run time. Can anybody please help me on this? I have a linked share connection established between the servers. Looking for an option to copy data faster. 回答1: BCP will almost certainly the fastest, however it is not transactional and the error trapping is rather poor. It's pretty easy to use

Why are my buffered points oblong and not circle in SQL Server Management Studio - Spatial Results

无人久伴 提交于 2020-01-15 07:14:20
问题 When I apply STBuffer(1) to a Point in SQL Server Spatial, they show up as an oblong circle, instead of a perfect circle. Why is this? 回答1: The selected projection is Equirectangular , and not the more familiar Mercator that we see in Google Maps & Bing Maps. Change this and the points will show up as expected. More information about map projection here: http://en.wikipedia.org/wiki/Map_projection 来源: https://stackoverflow.com/questions/19693067/why-are-my-buffered-points-oblong-and-not

How to get next/previous record number?

别来无恙 提交于 2020-01-15 04:39:13
问题 How to get previous record number in SQL Server? Data Table: Name | SO No. ----------------- Adrian | SO-00001 Adrian | SO-00002 Bianca | SO-00003 Carrie | SO-00004 Adrian | SO-00005 Bianca | SO-00006 Adrian | SO-00007 How can I get the result as below: Name | SO No. | Previous SO ------------------------------- Adrian | SO-00005 | SO-00002 回答1: This one will work the same in all major RDBMS (including SQL Server and MySql) UPDATED based on your comments SELECT name, so_no, ( SELECT MAX(so_no

When I try to execute the stored procedure in ColdFusion, then not all of the information is returned

心不动则不痛 提交于 2020-01-15 03:41:20
问题 When I try to execute the stored procedure in ColdFusion, then not all of the information is returned. I'm running ColdFusion 9.0.1 w/ Hot Fix 2. I'm working with SQL Server 2008 r2. I'm limited to stored procedure calls. I can execute a stored procedure in SQL Server Management Studio to return a single record either in as a variable or as a select statement. The complete record is returned. The data stored in the database is 36539 characters long. The data returned by ColdFusion from a

Group characters of varchar field

。_饼干妹妹 提交于 2020-01-15 03:29:07
问题 I am creating an import data tool from several vendors. Unfortunately the data is not generated by me, so i have to work with it. I have come across the following situation. I have a table like the following: ID |SartDate |Availability ======================================== H1 |20130728 |YYYYYYNNNNQQQQQ H2 |20130728 |NNNNYYYYYYY A3 |20130728 |NNQQQQNNNNNNNNYYYYYY A2 |20130728 |NNNNNYYYYYYNNNNNN To explain what this data means is: Every letter in the Availability column is the availability

A very complicated SQL query issue

流过昼夜 提交于 2020-01-14 19:22:10
问题 I have 2 tables ... Customer CustomerIdentification Customer table has 2 fields CustomerId varchar(20) Customer_Id_Link varchar(50) CustomerIdentification table has 3 fields CustomerId varchar(20) Identification_Number varchar(50) Personal_ID_Type_Code int -- is a foreign key to another table but thats irrelevant Basically, Customer is the customer master table (with CustomerID as primary key) and CustomerIdentification can have several pieces of identifications for a given customer. In other

Right Trimming Binary Data in SQL Server

一笑奈何 提交于 2020-01-14 12:43:28
问题 Scenario: I am inserting a string into a binary field (CONTEXT_INFO) and then later attempting to pull it out and convert it back to a string. When I do, the resulting string has a length of 128 because it has trailing null characters. Example: DECLARE @string VARCHAR(128) DECLARE @binary VARBINARY(128) SET @string = 'abcdefg' SET @binary = CONVERT(VARBINARY(128), @string) --0x61626364656667000000... SET CONTEXT_INFO @binary SET @binary = CONTEXT_INFO() -- I would like to change the following

DateAdd Column caused an overflow

≯℡__Kan透↙ 提交于 2020-01-14 10:08:06
问题 After executing the following query I am getting an error Adding a value to a 'datetime' column caused an overflow. I have no idea why this is happening as it worked smoothly for a couple of weeks. I am just trying to ADD Dates here and compare them to the Start date and End date with a between clause. DATEADD(day, -1 , DATEADD(mm, DATEDIFF(mm,0,posting_date),0)) BETWEEN start_date and end_date 回答1: I can duplicate the error with the following: declare @posting_date datetime set @posting_date

How to make SET XACT_ABORT ON rollback the transaction?

北城余情 提交于 2020-01-14 08:05:16
问题 Based on the Books Online documentation of SET XACT_ABORT ON, i get the impression that if a T-SQL statement raises a run-time error, the entire transaction is terminated and rolled back: Remarks When SET XACT_ABORT is ON, if a Transact-SQL statement raises a run-time error, the entire transaction is terminated and rolled back. Testing this in SQL Server 2008 R2: SET XACT_ABORT ON; BEGIN TRANSACTION; PRINT 'TranCount befor an error = '+CAST(@@Trancount AS varchar(50)) DROP TABLE QuertyAsdf

How to make SET XACT_ABORT ON rollback the transaction?

烈酒焚心 提交于 2020-01-14 08:05:08
问题 Based on the Books Online documentation of SET XACT_ABORT ON, i get the impression that if a T-SQL statement raises a run-time error, the entire transaction is terminated and rolled back: Remarks When SET XACT_ABORT is ON, if a Transact-SQL statement raises a run-time error, the entire transaction is terminated and rolled back. Testing this in SQL Server 2008 R2: SET XACT_ABORT ON; BEGIN TRANSACTION; PRINT 'TranCount befor an error = '+CAST(@@Trancount AS varchar(50)) DROP TABLE QuertyAsdf