sql-server-2000

SQL Server: Must numbers all be specified with latin numeral digits?

回眸只為那壹抹淺笑 提交于 2019-12-05 15:01:05
Does SQL server expect numbers to be specified with digits from the latin alphabet, e.g.: 0123456789 Is it valid to give SQL Server digits in other alphabets? Rosetta Stone: Latin: 01234567890 Arabic: ٠١٢٣٤٥٦٧٨٩ Bengali: ০১২৩৪৫৬৭৮৯ i know that the client (ADO) will convert 8-bit strings to 16-bit unicode strings using the current culture. But the client is also converting numbers to strings using their current culture, e.g.: SELECT * FROM Inventory WHERE Quantity > ২৩৪,৭৮ Which throws SQL Server for fits. i know that the server/database has it's defined code page and locale, but that is for

Why does TSQL on Sql Server 2000 round decimals inconsistently?

风格不统一 提交于 2019-12-05 13:28:12
I'm trying to calculate percent off values for dollar amounts. At 50%, sometimes you get half a penny, and I need to round it to the nearest cent. In Sql, my calculation is as follows: round(retail * 0.5, 2, 0) If I take the following values I get different results: 4.39 2.49 Unrounded I get: 4.39 --> 2.195 2.49 --> 1.245 When rounded I get: 2.195 --> 2.19 1.245 --> 1.25 I'm told this is a form of "banker's rounding", but it seems like the value that is affecting the rounding direction is the integer value. My problem is that I expect the top value to round to 2.20. If this is indeed bankers

Case-insensitive REPLACE() in SQL Server 2000

拟墨画扇 提交于 2019-12-05 07:03:23
I have a field that contains strings such as 'Blah-OVER', 'Blah-OveR', etc. and want to select them without the 'over's. This only catches the first case (so to speak) and not the others: SELECT field as "before", REPLACE(field, 'OVER', '') as "after" How do I just get them all to say 'Blah-' (preserving the case of what's left) without attempting to cover every case combination with another nested REPLACE function? Use a case insensitive collation: SELECT field as "before", REPLACE(field COLLATE SQL_Latin1_General_Cp1_CI_AI , 'OVER', '') as "after" See COLLATE for list of collation names so

Is timestampdiff() in MySQL equivalent to datediff() in SQL Server?

雨燕双飞 提交于 2019-12-05 06:45:46
I am working on migrating functions from SQL Server 2000 to MySQL. The following statement executed in SQL Server 2000, gives the output as 109. SELECT DATEDIFF(wk,'2012-09-01','2014-10-01') AS NoOfWeekends1 The equivalent query of in mysql uses timestampdiff() instead of datediff and gives the output as 108. SELECT TIMESTAMPDIFF(WEEK, '2012-09-01', '2014-10-01') AS NoOfWeekends1 I need the output to match when executed in MySQL, so it returns 109. I think this could be caused by one of 2 things: What is classified as the first day of the week between your SQL Server and MySQL instances. How

Why should I upgrade from SQL2000 to SQL2005?

試著忘記壹切 提交于 2019-12-05 06:01:59
I'm looking for the single biggest reason you are glad that you've already made the jump from SQL2000 to SQL2005. Recursion without creating temporary tables. Native Exception support (Try/Catch instead of if @Error goto) Because: Microsoft would like to remind customers that support for SQL Server 2000 Service Pack 3a (SP3a) will end on July 10, 2007. Native XML support is big for us here. SSIS support. Blows DTS away and is quite handy. :) SSRS - A really huge advantage for my organization is having the free reporting tools that come with SQL Server 2005. Reporting Services allows me to

Date object last modified

空扰寡人 提交于 2019-12-05 05:26:26
How can I find out the date a MS SQL Server 2000 object was last modified? I need to get a list of all the views, procs, functions etc that were modified since Aug 15th. In sysObjects I can see the date objects were created but I need to know when they were last altered. NB: this is an SQL 2000 database. Note that SQL Server actually does not record the last modification date. It does not exist in any system tables. The Schema Changes History report is actually constructed from the Default Trace . Since many admins (and web hosts) turn that off, it may not work for you. Buck Woody had a good

What is the limitation in the length of an SqlCommand query

▼魔方 西西 提交于 2019-12-05 05:25:25
Is there a limitation in the length of a query that SQL Server can handle? I have a normal SqlCommand object and pass a very long select statement as a string. The query seems to be fine when running against an SQL Server 2005/2008 engine but doesn't execute against an SQL Server 2000 engine. I don't have any error details as I only have this information 3rd hand but my application isn't working as expected. I could go to the trouble of installing an SQL Server 2000 instance but I was just wondering if anyone has a quick. Yes there is a 4K or 8K limit in SQL Server 2000 but not in 2005 type

How to get columns Primary key constraints using SqlConnection.GetSchema()

这一生的挚爱 提交于 2019-12-05 04:34:47
I have some code of ADO.NET to dynamically detect the database schema, what I need is how to get unique columns constraints and Primary key constraints using the GetSchema method on SqlConnection . This is the code that I have: conn.Open(); SqlCommand mSqlCommand = new SqlCommand("sp_pkeys", conn); mSqlCommand.CommandType = CommandType.StoredProcedure; mSqlCommand.Parameters.Add( "@table_name", SqlDbType.NVarChar).Value = tableName; SqlDataReader mReader = mSqlCommand.ExecuteReader( (CommandBehavior.KeyInfo | CommandBehavior.SchemaOnly)); //ExecuteReader(); DataTable schema = mReader

How to convert a varchar column to bit column in SQL SERVER

眉间皱痕 提交于 2019-12-05 04:24:45
Flag1 is a varchar column with values "true" and "false". I need to convert this into bit column. When I try to do this: Convert(Bit,Flag1) it shows an error Msg 245, Level 16, State 1, Line 2 Syntax error converting the varchar value 'False' to a column of data type bit. I suspect that there are other values in addition to 'true' and 'false' in the field 'Flag1'. So check for the values in Flag1. select distinct Flag1 from YouTable. Here is my proof: declare @Flag varchar(25) = 'False' select CONVERT(Bit, @Flag) It works fine. However, this will give the same error. declare @Flag varchar(25)

SQL query to return one single record for each unique value in a column

落花浮王杯 提交于 2019-12-05 03:35:13
I have a table in SQL Server 2000 that I am trying to query in a specific way. The best way to show this is with example data. Behold, [Addresses] : Name Street City State -------------------------------------------------------- Bob 123 Fake Street Peoria IL Bob 234 Other Street Fargo ND Jim 345 Main Street St Louis MO This is actually a simplified example of the structure of the actual table. The structure of the table is completely beyond my control. I need a query that will return a single address per name. It doesn't matter which address, just that there is only one. The result could be