sql-server-2000

ORDER BY in VIEW returns different results SQL

巧了我就是萌 提交于 2019-12-23 14:01:30
问题 This is my viww: CREATE VIEW [STD_USER].[view_TransInvoice] AS SELECT TOP 999999 Customernr, Referensnr,'2' as a, InvoiceRowData, FileHead FROM [STD_USER].[Transexport] WHERE InvoiceRowData IS NOT NULL UNION SELECT TOP 999999 Customernr, Referensnr,'1' AS a , InvoiceHead , FileHead FROM [STD_USER].[Transexport] WHERE InvoiceHead IS NOT NULL UNION SELECT TOP 999999 Customernr, Referensnr,'3' AS a , InvoiceFoot , FileHead from [STD_USER].[Transexport] WHERE InvoiceFoot IS NOT NULL ORDER BY

SQL Server: How to abort a series of batches in Query Analyzer?

☆樱花仙子☆ 提交于 2019-12-23 10:35:22
问题 i have a series of T-SQL statements separated by the special Query Analyzer batch separator keyword: GO If one batch fails, i need Query Analyzer to not try subsequent batches - i want it to stop processing the series of batches. For example: PRINT 'This runs' go SELECT 0/0, 'This causes an error' go PRINT 'This should not run' go Output: This runs Server: Msg 8134, Level 16, State 1, Line 2 Divide by zero error encountered. This should not run Possible? Update An example of this in real use

Why does SQL Server 2000 treat SELECT test.* and SELECT t.est.* the same?

廉价感情. 提交于 2019-12-23 06:48:09
问题 I butter-fingered a query in SQL Server 2000 and added a period in the middle of the table name: SELECT t.est.* FROM test Instead of: SELECT test.* FROM test And the query still executed perfectly . Even SELECT t.e.st.* FROM test executes without issue. I've tried the same query in SQL Server 2008 where the query fails (error: the column prefix does not match with a table name or alias used in the query). For reasons of pure curiosity I have been trying to figure out how SQL Server 2000

Addresses stored in SQL server have many small variations(errors)

五迷三道 提交于 2019-12-23 02:51:07
问题 I have a table in my database which stores packing slips and their information. I'm trying to query that table and get each unique address. I've come close, but I still have many near misses and I'm looking for a way to exclude these near duplicates from my select. Sample Data CompanyCode CompanyName Addr1 City State Zip 10033 UNITED DIE CUTTING & FINISHIN 3610 HAMILTON AVE CLEVELAND Ohio 44114 10033 UNITED DIE CUTTING & FINISHING 3610 HAMILTON AVE CLEVELAND Ohio 44114 10033 UNITED DIE

How to transfer the server logins from SQL Server 2000 to SQL Server 2012

回眸只為那壹抹淺笑 提交于 2019-12-23 01:53:12
问题 I have migrate the database from SQL Server 2000 to SQL Server 2012. But how to transfer the server logins from SQL Server 2000 to SQL Server 2012? The server logins are below the Server Security. 回答1: Run the following script on the 2000 SQL Server: USE master GO IF OBJECT_ID ('sp_hexadecimal') IS NOT NULL DROP PROCEDURE sp_hexadecimal GO CREATE PROCEDURE sp_hexadecimal @binvalue varbinary(256), @hexvalue varchar(256) OUTPUT AS DECLARE @charvalue varchar(256) DECLARE @i int DECLARE @length

How to Convert a SQL Query using Common Table Expressions to One Without (for SQL Server 2000)

旧巷老猫 提交于 2019-12-22 19:00:25
问题 I just found an adequate solution to How to Find Rows which are Duplicates by a Key but Not Duplicates in All Columns?, coded the stored procedure, then learned that the database is stuck at SQL Server 2000. My solution, of course, relies heavily on Common Table Expressions. Can anyone provide me a set of ru les for converting back to the SQL Server 2000 dialect? Note that I have things like thisL: ; WITH CTE1 AS ( ... ), CTE2 AS (SELECT ... FROM CTE1 ... ), CTE3 AS (SELECT ... FROM CTE1

Collation conflict in SQL Union All Query

拈花ヽ惹草 提交于 2019-12-22 17:22:54
问题 There is a Union All query as shown below. When fired in SQL server, I get an error "Cannot resolve collation conflict for column 1 in SELECT statement." Please, where do I add the Collate database_default statement with this Union All query? select OrgCode,null as OrgName, Q1_A1 as A1Value,Q1_a2 as A2Value,'Quarter 1' as dt,((Q1_A1-Q1_A2)/case when Q1_A1<>0 then Q1_A1 else null end )*100 Percentage from #Tabl_Quarter_Calculation union all select OrgCode,null as OrgName,Q2_A1 as A1Value,Q2_a2

Collation conflict in SQL Union All Query

若如初见. 提交于 2019-12-22 17:22:52
问题 There is a Union All query as shown below. When fired in SQL server, I get an error "Cannot resolve collation conflict for column 1 in SELECT statement." Please, where do I add the Collate database_default statement with this Union All query? select OrgCode,null as OrgName, Q1_A1 as A1Value,Q1_a2 as A2Value,'Quarter 1' as dt,((Q1_A1-Q1_A2)/case when Q1_A1<>0 then Q1_A1 else null end )*100 Percentage from #Tabl_Quarter_Calculation union all select OrgCode,null as OrgName,Q2_A1 as A1Value,Q2_a2

How to use a SQL2000 Linked Server to query an Oracle 11G table

和自甴很熟 提交于 2019-12-22 17:06:25
问题 Can someone help me construct the SQL that I need to query the Projects_dim table using the Linked Server "idwd"? To test the connection, I ran a sample query using the linked server name. To access the tables on the linked server, I used a four-part naming syntax: linked_server_name.catalog_ name.schema_name.table_name. replacing the values, you get: idwd.idwd.wimr.PROJECTS_DIM of should it be the following? idwd..wimr.PROJECTS_DIM The database name is "idw" but the grid below shows a blank

Speed up sql JOIN

若如初见. 提交于 2019-12-22 16:39:15
问题 First of all, some background. We have an order processing system, where staff enter billing data about orders in an app that stores it in a sql server 2000 database. This database isn't the real billing system: it's just a holding location so that the records can be run into a mainframe system via a nightly batch process. This batch process is a canned third party package provided by an outside vendor. Part of what it's supposed to do is provide a report for any records that were rejected.