Showing posts with label includes. Show all posts
Showing posts with label includes. Show all posts

Monday, March 19, 2012

Is there WHERE for columns

Hi everybody,
Is there a way to filter columns at runtime based on their name?

I create SELECT statement which includes all columns, then, if I get some parameter I leave some columns out and don't select data from them.

Is it possible?

I'm working with MS SQL 2000.You can't omit columns. The closest thing you can do is use CASE expressions to hide the data you don't want to show, such as:

SELECT Col1, Col2, CASE WHEN Col1 = 'someValue' THEN Col3 ELSE NULL END AS Col3
FROM YourTable|||Is this possible:

SELECT Col1, Col2, CASE WHEN SomethingOutsideThisSelectCommand = 'someValue' THEN Col3 ELSE NULL END AS Col3
FROM YourTable|||As long as it's a valid SQL expression, it shouldn't be a problem.

Monday, March 12, 2012

Is there one collation that includes all the Eastern Europen Languages and Latin 1 charset.

Can I specify a collate value for a column in a table that includes all the possible languages in the world or atleast Latin 1 and Eastern European languages.

My DB Collation is set to Latin 1 and the columns in the tables are all nvarchar or ntext, but certain hungarian characters are not displayed correctly.

What do all these collation codes represent:

SQL_EBCDIC037_CP1_CS_AS

211

SQL_EBCDIC273_CP1_CS_AS

212

SQL_EBCDIC277_CP1_CS_AS

213

SQL_EBCDIC278_CP1_CS_AS

214

SQL_EBCDIC280_CP1_CS_AS

215

SQL_EBCDIC284_CP1_CS_AS

216

SQL_EBCDIC285_CP1_CS_AS

217

SQL_EBCDIC297_CP1_CS_AS

They seem generic. Is there one collation that includes all the Eastern Europen Languages and Latin 1 charset. Please let me know.

Thanks,

Manisha

The collation affects sorting and code page for non-Unicode data. Since you are using Unicode strings (nvarchat & ntext) - the collation only affects sorting, it does not affect the character display.

If a character is not displayed correctly, it means either the data was converted to non-Unicode somewhere (check all the column types in SSIS) or the font does not support this character. You are not telling us where the character is displayed, so I have no idea which font are you using.

To answer original question - no, there is no universal collation, as each culture has its own sorting rules. But most probably the collation is not the problem here.|||The character is displayed on the webpage (jsp) where it is displayed incorrectly. However in the database when I open table it displays perfectly. I realize that there is no universal collation then it is probably a font issue as indicated, but I am being told by our front end developer that we are using Verdana font for display and that includes Hungarian Chars.|||I think the problem is not collation, but the code pages that front end developers use. The only common used encodings that includes all languages are Unicode and UTF-8, ask front end devs to generate their pages using UTF-8, and properly annotate them (I can't help you there, don't know JSP at all, seek a better forum).|||Thanks. We got this fixed yesterday by specifying the contentType on the JSP page level.