Inconsistent Sort Orders
Jan 11, 2008
Hello all-
Maybe someone has some insight on this... I currently have some hash values (SHA512 through Enterprise Library) that I'm trying to compare to data in our database. When I sort the values on the pipeline (DT_STR, 1252) with a Sort and compare them against values coming out of an OLE DB Source (SQL_Latin_1_General_CP1_CI_AS) with a Merge Join, any hash that has a '/' in it is treated as inequal to the one in the database.
For even more fun, when I change the sort/merge join to a Lookup, everything (seems) to check out. Is the 1252 code page not the same as SQL_Latin_1_General_CP1_CI_AS? Any other reasons this might be happening?
Cheers,
-Brandon Tucker
View 15 Replies
ADVERTISEMENT
Oct 5, 1999
Is there a query you can run against a 7.0 server to return the chracter set and sort order.
View 1 Replies
View Related
Feb 12, 2008
Hi There i have two windows 2000 servers which are both running SQL and i would like to restore a backup from one server to the other. Which in my opinion should be an easy task but when i go into the restore option and point it at the file i would like to restore i get the follwoing error
"The database you are attempting to restore was backed up under a different sort order ID (52) than the one you are currently using on this server (50) and at least one of them is a non binary sort order. Backup or restore operation operation terminating abnormally."
The server that i am trying to restore to already has databases on this so i cannot just reinstall SQL and change the sort order not that id know how to do that but this is what i have read.
Is htere anyway that i can put insome script for the database to fix this ???
Im using Enterprise manager with SQL server 7
Thanks in advance
View 14 Replies
View Related
Feb 27, 2004
Hi,
Just wanted to check. I've got a SQL 7.0 box on NT4 with about 40 databases (each about 500Mb-1Gb) which I want to move to SQL2000.
The main problem is, the 7.0 box was built with a sort order not officially supported by the finance software that uses the databases, so I want to build the SQL2000 box with the default sort orders and character sets.
I've done this in a test environment by copying the .mdf files accross and attaching them to the SQL2000 box, and this all seems to work. But is this advisable, and will there be any problems?
Thanks for the help!!
View 4 Replies
View Related
Jul 20, 2000
Other than the error log is there an easy way to find the sort order and
chracter set of an installed SQL Server. Also after finding the numbers
is there a good reference to tell you what these numbers mean.
Thanks
View 1 Replies
View Related
Aug 6, 2007
Hi,
I am developing database support for my application and I am using EDB. I would like to use sort orders to make the code easier but I was wondering if sort orders generate index tables. I mean, do they only sort the records during addition or they also generate index tables to speed up queries. In other words, do they make the database file bigger?
In the MSDN documentation I can not find anything on this.
Thanks,
Giulio
View 4 Replies
View Related
Mar 19, 2007
I am getting the resultset sorted differently if I use a column number in the ORDER BY clause instead of a column name.
Product: Microsoft SQL Server Express Edition
Version: 9.00.1399.06
Server Collation: SQL_Latin1_General_CP1_CI_AS
for example,
create table test_sort
( description varchar(75) );
insert into test_sort values('Non-A');
insert into test_sort values('Non-O');
insert into test_sort values('Noni');
insert into test_sort values('Nons');
then execute the following selects:
select
*
from
test_sort
order by
cast( 1 as nvarchar(75));
select
*
from
test_sort
order by
cast( description as nvarchar(75));
Resultset1
----------
Non-A
Non-O
Noni
Nons
Resultset2
----------
Non-A
Noni
Non-O
Nons
Any ideas?
View 4 Replies
View Related
Aug 7, 2007
I am trying to set sorting up on a DataGrid in ASP.NET 2.0. I have it working so that when you click on the column header, it sorts by that column, what I would like to do is set it up so that when you click the column header again it sorts on that field again, but in the opposite direction. I have it working using the following code in the stored procedure: CASE WHEN @SortColumn = 'Field1' AND @SortOrder = 'DESC' THEN Convert(sql_variant, FileName) end DESC,
case when @SortColumn = 'Field1' AND @SortOrder = 'ASC' then Convert(sql_variant, FileName) end ASC,
case WHEN @SortColumn = 'Field2' and @SortOrder = 'DESC' THEN CONVERT(sql_variant, Convert(varchar(8000), FileDesc)) end DESC,
case when @SortColumn = 'Field2' and @SortOrder = 'ASC' then convert(sql_variant, convert(varchar(8000), FileDesc)) end ASC,
case when @SortColumn = 'VersionNotes' and @SortOrder = 'DESC' then convert(sql_variant, convert(varchar(8000), VersionNotes)) end DESC,
case when @SortColumn = 'VersionNotes' and @SortOrder = 'ASC' then convert(sql_variant, convert(varchar(8000), VersionNotes)) end ASC,
case WHEN @SortColumn = 'FileDataID' and @SortOrder = 'DESC' THEN CONVERT(sql_variant, FileDataID) end DESC,
case WHEN @SortColumn = 'FileDataID' and @SortOrder = 'ASC' THEN CONVERT(sql_variant, FileDataID) end ASC And I gotta tell you, that is ugly code, in my opinion. What I am trying to do is something like this: case when @SortColumn = 'Field1' then FileName end,
case when @SortColumn = 'FileDataID' then FileDataID end,
case when @SortColumn = 'Field2' then FileDesc
when @SortColumn = 'VersionNotes' then VersionNotes
end
case when @SortOrder = 'DESC' then DESC
when @SortOrder = 'ASC' then ASC
end and it's not working at all, i get an error saying: Incorrect syntax near the keyword 'case' when i put a comma after the end on line 5 i get: Incorrect syntax near the keyword 'DESC' What am I missing here? Thanks in advance for any help -Madrak
View 1 Replies
View Related
Feb 26, 2006
Hello all, have a temp table where I put data from a shopping cart. I need to take the data from this temp table and put it into an orders table and an orderItems table. The table structure is as follows: The cstb_orders.orderId has a one to many relationship with the cstb_orderItems.orderId cstb_orderItemsTemp id --pk invtId descr location quantity username shiptoaddress shiptocity shiptostate shiptozip shiptophone shiptofax cstb_orders orderId --pk username shiptoaddress shiptocity shiptostate shiptozip shiptocity shiptostate shiptozip shiptophone orderdate --auto date shipdate --null cstb_orderItems id --pk orderId --fk invtId descr location quantity What is the best way to accomplish this?
View 1 Replies
View Related
May 10, 2007
Good day.
Am new with SQL server and i use SQL Server 2005
i have 3 tables (1 = customers, 2 = orders, 3 = keys) both these tables are linked by the key table
I wanna be able to "view" (as am only allowed to view) the last three orders for every customer.
I tried using the top predicate/ clause with a group by & count but unfortunately am getting no where.
Please kindly help
View 14 Replies
View Related
May 22, 2007
I have a pretty straight forward fact table that contains order information like this:
DateTimeStamp Price OrderID
I have a measure that does a simple row count for orders placed. How can I get the Max Orders Placed grouped by Hour? Something similar to this:
0:00 15
1:00 25
2:00 50
.....
23:00 75
I tried to do a max function like max([time].[hour], [measures].[Order Row Count]) but ended up with only one value. I know I'm doing it wrong.
I appreciate any help on this.
View 1 Replies
View Related
Apr 25, 2007
Hi guys
Am new in SQL server. i use SQL server 2003 ans am trying to retieve the last three orders made. Can you please help me with my Select statement so that it will only select the last three coz @ the moment it selects everything
CODE:
SELECT dbo.Invoice.InvoiceNo, dbo.Sales.UnitsSold, dbo.Sales.QuantitySold, dbo.Sales.CostAmount, dbo.Item.ItemCode, dbo.Item.ItemDescription,
dbo.Item.Item, dbo.PurchaseOrder.OrderNumber, dbo.PurchaseOrder.OrderDate, dbo.PurchaseOrder.OrderStatus, dbo.PurchaseOrder.QuantityOrdered,
dbo.PurchaseOrder.QuantityReceived, dbo.Customer.CustomerCode
FROM dbo.Invoice INNER JOIN
dbo.Sales ON dbo.Invoice.InvoiceKey = dbo.Sales.InvoiceKey INNER JOIN
dbo.Item ON dbo.Sales.ItemKey = dbo.Item.ItemKey INNER JOIN
dbo.PurchaseOrder ON dbo.Sales.VendorKey = dbo.PurchaseOrder.VendorKey INNER JOIN
dbo.Customer ON dbo.Sales.CustomerKey = dbo.Customer.CustomerKey
Thanks
Noks
View 14 Replies
View Related
Apr 25, 2012
I'm suppose to List all orders where there is no shippedDate (just give their orderNumbers).
I have this:
select orderNumber from orders where shippedDate= null;
I'm not sure what to put in place of the "= null" as that is clearly wrong
(Note: If I use "select orderNumber from orders where shippedDate;" it prints out all the orders, but I only want the orders where there are no ShippedDate...
View 3 Replies
View Related
Jun 10, 2008
I am trying to Invoice all of the records in my 'Orders' table. After each of the records has been invoiced I would like SQL to flag that record as having been completed so that when I run my query the next day it will ignore those having been completed already. Any feedback would be greatly appreciated.
This is the query I wrote to invoice one Order at a time by specifying each Order_Num seperately. As you can tell...I'm a n00b. Thanks all.
select convert(varchar, getdate(), 107) as Date
select order_num as 'Invoice No.' from orders
where order_num = '20009'
select c.cust_name as Customer, c.cust_address as 'Street Address',
c.cust_city as City, c.cust_state as State, c.cust_zip as 'Zip Code'
from customers as c, orders as o
where c.cust_id = o.cust_id and order_num = '20009'
select oi.order_item as 'Line Item', oi.quantity as QTY, p.prod_name as 'Product Name',
oi.item_price as 'Sale Price', oi.quantity*oi.item_price as Total
from orderitems as oi, products as p
where oi.prod_id = p.prod_id and order_num = '20009'
order by oi.order_item
select sum(quantity*item_price) as Subtotal, sum(quantity*item_price*.089) as 'Tax 8.9%', sum(quantity*item_price)+ sum(quantity*item_price*.089) as Total
from orderitems
where order_num = '20009'
View 9 Replies
View Related
Jan 22, 2014
I have three SQL tables that I am trying to join. One is Called Customer and the other Orders.
Customer contains these fields that I need
CustomerID,Email,FirstName,LastName,
Orders has these that i need
OrderNumber,CustomerID,OrderTotal,OrderSubTotal
OrdersShoppingCart has these that I need
OrderNumber,CustomerID,OrderedProductSKU,OrderedProductName,OrderedProductPrice
What I would like to try to export is this
CustomerID
FirstName
LastName
Order ID
SKU
Order Total
This would be grouped for each customer for all total orders. Do you think this is possible?
View 9 Replies
View Related
Sep 26, 2007
I am trying to link my ORDERS table to my CUSTOMERS table.
The Primary key in the CUSTOMERS table is a UNIQUEIDENT.
The foreign key it is linking to is an INT.
When I run a query in ACCESS, it says type mismatch....
Any solutions?
View 1 Replies
View Related
Mar 3, 2008
Hi,
I have two tables customers and orders. customerID is the foreign key for order table. If I pass customername I need to get information about each customer how many orders holding?
View 3 Replies
View Related
Jan 22, 2007
I have a table with orders and customer info. I want to retrieve only customers with new orders only. These are the available fields: customer Id, Order Id, Order Date, and Order Subtotal. I need help with the "where" section of the query.
View 1 Replies
View Related
Feb 22, 2007
Hi,
I am using a stored procedure that is databound to a dropdownlist. The stored procedure works fine, aside from the fact that the ORDER BY only sorts the list of items using the first character in the cell. E.g. The numbers 1, 20, 100 and 200 would be ordered as follows:
1
100
20
200
clearly i am doing something wrong and i apologise if it is a stupid question, but could anyone please offer me some help?
Thank you,
Shep
View 11 Replies
View Related
Sep 26, 2012
I want to update the orders that has invoice number empty when doing a change in the customer table Nm.
My order table is named order and customer is named customer, they both have a column named CustId and Nm (name).
This works fine and shows in my case column Nm in 4 rows (for orders);
select
Order.Nm
from
Order
Join Customer
on Order.CustId=Customer.CustId
where
Order.CustId=@variable and InvoNo=''
But the update statement gets error;
Update
Order
set
Order.Nm=Customer.Nm
from
Order
inner join Customer
on
Order.CustId=Customer.CustId
where
Ord.CustId=@Variable and InvoNo=''
I use SQL 2008....
View 13 Replies
View Related
Feb 27, 2015
I want to select last order's details for each customer
[URL] ...
I have one table. id is primary key. No Foreign Key
I could select last date and customerid but I want to see quantity, productid, total in last date for each customerid
[URL] .....
View 7 Replies
View Related
May 7, 2015
How to get the result for current date orders but I can get the query working for due date.
"
SalesOrder.DateEntered,
SalesLine.OrderQuantity, (SalesLine.OrderQuantity*SalesLine.SellingPrice / SalesOrder.ExchangeRate) AS Value,
(SalesLine.SellingPrice / SalesOrder.ExchangeRate) AS Price
FROM Company INNER JOIN
CustomerAccount ON Company.CompanyID = CustomerAccount.CompanyID INNER JOIN
SalesOrder ON CustomerAccount.CustomerAccountID = SalesOrder.CustomerAccountID INNER JOIN
SalesLine ON SalesOrder.SalesOrderID = SalesLine.SalesOrderID
WHERE (SalesOrder.DateEntered = { fn CURDATE() })
"
How could I get the current date orders?
View 9 Replies
View Related
Nov 5, 2013
SQL 2012
I'm wanting to get the average number of days between orders in my orders tbl - so I've done a search and found the following sql coded that I have modified for my db tbl's and columns. But when I try and parse it - I get 'Incorrect syntax new the keyword Group' - what am I missing.
SELECT custId, AVG(invDate - priorDate)
FROM(SELECT custId,invDate,LAG(invDate) OVER (PARTITION BY custId ORDER BY invDate)as priorDate
FROM orders)
Group BY custId
View 5 Replies
View Related
Apr 20, 2007
Hi,
Im using Access and have created a query which adds up the grand totals of clients orders. However i want to be able to add up what each client has spent in total over any given time period. Basically in SQL logic terms:
take all order totals from same client and add together order totals to produce a grand client spend total.
Anyone help!?
thanks
View 3 Replies
View Related
Mar 25, 2008
I'm trying to create a couple of reports and I'm having trouble coming up with a way to do what I need to do. I already have several SQL views that I use for other reports, and they are geared toward either order-based or product-based reporting. For order-based reporting, I'm grouping the detail order lines by the order number. For product-based reporting, I'm not worrying about the order numbers necessarily.
Here's my problem. I need to report on orders that have a particular product line in them (the product codes in this case start with the same letter, unique from other product lines), and separate the dollars coming from that product line and what sold with it. Something like:
Orders sold with these (A) products in them:
Aproduct1 total orders $1000, $600 of which was Aproduct1 and $400 of which was Bproduct1 and Bproduct2
Aproduct2 total orders $500, $500 of which was Aproduct2
Aproduct3 total orders $700, $400 of which was Aproduct3 and $300 of which was Cproduct4
etc.
The data looks like this:
(Order#) 12345 (ProductCode) Aproduct1 (quantity) 1 (dollars) $200
12345 Bproduct1 1 $100
12348 Cproduct2 2 $500
12350 Aproduct2 1 $500
12350 Cproduct1 1 $50
12350 Bproduct2 1 $300
etc.
So I'd need to pick out orders 12345 and 12350 and separate the dollars. The thing is the three products in 12350 don't know about each other.
Any ideas?
View 1 Replies
View Related
Feb 11, 1999
I need some advise on how to check the consistensy of a DateTime attribute.
Some of my Datetime field(s) won't read as a NULL and some does for example:
Select FileNo,DateReceived,DateEntered,DateFU from RECEIVING
where DateReceived is not null and DateEntered is not null and DateFU is not null
I should get several records but the result is zero.
Is there any articles out there about DateTime ?
I appreciate any help.
Thanks
Rey Caunca
View 1 Replies
View Related
Apr 11, 2006
HiI have an oddity. If I run a piece of SQL:SELECT EmployeeNo, MailToFROM ST_PPS.dbo.Employeewhere AddedOn BETWEEN '01-jan-2006' and '01-feb-2006'AND MailTo NOT IN ( '3', 'x')order by MailToI get the resultsEmployeeNo MailTo----------- ------608384 1606135 1608689 1609095 1607163 1606165 1606472 1608758 1.....for 2594 rowsIf I create a stored procedure with the same SQL:-CREATE PROCEDURE dbo.PPS_testASSELECT EmployeeNo, MailToFROM ST_PPS.dbo.Employeewhere AddedOn BETWEEN '01-jan-2006' and '01-feb-2006'AND MailTo NOT IN ( '3', 'x')order by MailToGOand run it:-EXEC PPS_testI get three extra rowsEmployeeNo MailTo----------- ------607922 NULL606481 NULL605599 NULL606316 1608871 1607427 1608795 1.....for 2597Does anyone know what is happening here? It appears that the clause:-MailTo NOT IN ( '3', 'x')excludes NULL in raw SQL, but includes NULL (correctly I think) in astored procedure.Chloe CrowderThe British Library
View 5 Replies
View Related
Jul 20, 2005
I get an error every so often with a DTS package on SQL 7. Error asfollows.The connection is currently being used by a task. The connectioncannot beclosed or re-used.This doesn't happen all the time and I can sometimes (more often thannot) get the DTS package to complete in it's entirety.To explain what the DTS package does...Truncate tables in reporting environment(several in a batch)Clear Transaction LogsCopies data from live environment into CSV (for speed)Copies data from CSV files into tables previously truncated.Builds up a table based on the data copied (for reporting)Clear Transaction logsI'm using a pretty basic set up, Connection (1st DB) -> Transformationto CSV -> Transformation to Connection (2nd DB). It seems to fail oneither the first or second transformation at random (?).I've checked the transformations so that they close the connectionafterwards so it should in theory be releasing the CSV files for thenext step. I suspect that there is a timing issue with this. I cancopy the CSV files over, but this is a little sloppy and I wouldprefer not to do it.Any ideas how to find a tidy way to ensure these are closed bothbefore and afterwards ?ThanksRyan
View 2 Replies
View Related
May 5, 2008
Hi,
I am building a report with a recursive hierarchy for drill-down purposes. The hierarchy is built by querying a SSAS OLAP cube and defining a details grouping for the table/matrix.
Every time I run the report one or more of the leaf members in the recursive hierarchy "jumps" up to the highest level. First I thought that this may be due to the fact that the leafs parents are not part of the returned dataset. However, the queries makes sense and the "offending" members does never contain any data (while the query should return only non empty members) which is why this is a very strange behavior. Furthermore, the "offending" member differs between different executions of the report, despite the fact that the parameters is exactly the same and the cube is untouched between executions.
I am actually pressing "View Report", waiting for the report to execute and when I press "View Report" again, the returned datasets seem to differ, yielding different "offending" members in the report.
When I run the queries individually in the Data-tab in BIDS, the returned datasets are always the same. Execution caching is turned off for the report.
Checking against SSRS's ExecutionLog, the RowCount for consecutive executions with the exact same parameters differ. For example, RowCount:
3094
3080
3079
3088
3087
Why does SSRS behave such inconsistently? Any tips or tricks?
View 3 Replies
View Related
Apr 7, 2015
I need to calculate the average number of days between customer orders.
My table has customer number and order number and the order date.
I would like to end with customer number last, order date and the average number of days between orders for each customer.
cust_idorder_numorder_date
HOLLGCAB 119482 02/27/2015
JILCO 119484 02/27/2015
KEY 119491 02/27/2015
TURNER 119496 02/27/2015
KEY 119499 02/27/2015
[Code] .....
View 9 Replies
View Related
Jul 20, 2005
I have a column named "LIST" in a table with strings like the following:151231-1002-02-1001151231-1001-02-1001151231-1002-02-1002151231-1003-02-1001etc....What I'd like to do is include an ORDER BY statement that splits thestring, so that the order would be by the second set of four numbers(i.e. between the first and second - marks), followed by the third setof two numbers, and then by the last set of four numbers.How would I do something like this?--Sugapablo - Join Bytes!http://www.sugapablo.com | ICQ: 902845
View 1 Replies
View Related
Sep 14, 2006
Using the northwind database, how do I select the cutomerID of customers who havnt placed an order.
is it something like this?
select Customers.CustomerID
FROM Customers INNER JOIN Orders ON Customers.CustomerID <> Orders.CustomerID
and how can I display the customers who HAVE made orders alongside customers who havnt made orders.
Thanks in advance.
View 6 Replies
View Related
Apr 10, 2001
I am running SQL Server 7.0 on NT 4.0. I have created a simple query:
SELECT SUM(month1) As total_month1
FROM eac_manload
WHERE project_number = 8800
and dept IN (50,51,52,55,57,60,61,62,63,64,65,68,69)
I first time I run the query I get the correct result. Subsequent times that I run the query the result is 1 record with a Null value. The data has not changed. If I stop MSSQLSERVER and restart the service I get the correct result the first time and the Null value each time thereafter. Anybody out there with any idea of what is going on here? Any help will be appreciated!!
View 1 Replies
View Related