How sql server compares strings - sql-server-2012

How sql server compares strings! Can he identify the bigest or the smallest between two chains
for example
One date in string format: "2019-01-02 00:00:00"
How does she see this string of characters?

SQL Server uses "Collation" to compare strings. Here's a Microsoft article explaining collation:
Collation and Unicode Support

Related

Convert DB2 EBCDIC column to Ascii in a SQL Statement

I know I can do the conversion very easily using C# or any other number of programming languages, however, I want to know if I can do the conversion of a column that has EBCDIC encoded text so that the result of the query is in a readable string such as ascii encoded.
Ultimately, I will import the data into SQL Server and I know SSIS can do it, but before I do that, I want to exhaust any paths that are not SQL language.
For example a little know combination of built in functions available in DB2 SQL or SQL-Server 2008
Here is an example of data
Data as stored in DB2: 0xC6C3C3C1E3C5D9D7C9D3D360F8F840
Text: FCCATERPILL-88
The C# conversion is so easy so I included it here:
System.Text.Encoding ei = Encoding.GetEncoding(37);
textBox1.Text = ei.GetString(allBytes.ToArray())
I'm not an AS400 admin so I'm not sure what to do with what is being suggested in the comments.

How to get the length of the contents of a varbinary field with SQL in Advantage Database Server db?

Does anyone know if it is possible to get the length of the contents of a varbinary field using SQL with Advantage Database Server V11?
Regards
The obvious function to look for would be LENGTH(field) or LEN(field) (see online help).
If those only work on character fields, then you can always cast.

Date and time comparison in SQL Server

I am very new to SQL Server. My problem is to write a SQL query that compares datetime column with some fixed date AND time, but I would like to make it independent of language settings (regarding date and time values).
SQL Server doesn't store a DateTime in any string format - it's stored as an 8 byte numerical value. So when stored, there's no issue with language dependent formats or anything like that.
When using string literals representing date and time, however, there are many formats supported by SQL Server. The way to go is to use the (slightly adapted) ISO-8601 date format that is supported by SQL Server - this format works always - regardless of your SQL Server language and dateformat settings.
The ISO-8601 format is supported by SQL Server for date and time looks like this:
YYYY-MM-DDTHH:MM:SS - note here: this format has dashes (but they can be omitted), and a fixed T as delimiter between the date and time portion of your DATETIME.
This is valid for SQL Server 2000 and newer.

SOUNDEX function seems broken in SQL Server 2012

The following statements return different SOUNDEX values in SQL Server 2012 while they produce the same value in SQL Server 2008:
PRINT SOUNDEX('BAKHSHI') --B200
PRINT SOUNDEX('Bakhshi') --B220
Has anyone else had this issue in SQL Server 2012 and knows how to get around it?
According to https://msdn.microsoft.com/en-us/library/bb510680.aspx:
SOUNDEX function implements the following rules: If upper-case H or
upper-case W separate two consonants that have the same number in the
SOUNDEX code, the consonant to the right is ignored If a set of
side-by-side consonants have same number in the SOUNDEX code, all of
them are excluded except the first. The additional rules may cause the
values computed by the SOUNDEX function to be different than the
values computed under earlier compatibility levels. After upgrading to
compatibility level 110, you may need to rebuild the indexes, heaps,
or CHECK constraints that use the SOUNDEX function. For more
information, see SOUNDEX (Transact-SQL)
So you might want to try following Microsoft's upgrade path advice. Also, SOUNDEX is collation sensitive - are your 2012 DB collations the same as your 2008 collations?

which data type can save bangla Language in sql server?

I want to save bangla Language in sql server. Using which data type I can Do it in sql server 2005 or sql server 2008.
I tried varchar and varbinary type but it cannot save bangla Language.
How is it possible?
You're using SQL_Latin1_General_CP1_CI_AS for your collation, which is suited for the Latin character set (ISO-8859-1). To store characters fromother character sets, you can use the NVARCHAR() which can store the full Unicode range, irrespective of collation - this does mean it will need to be treated as NVARCHAR() all the way, as quoted constants (e.g. N'বাংলা Bangla'), as the data types for parameters to stored procedures, etc.