In SQL Server how to change a collation of only selected columns? Is there a way to do that using SQL Server Management Studio?
I was googling around but what I found where instructions how to change collation of a database not a specific column.
EDIT:
So I found this bit of SQL to change column's collation:
ALTER TABLE MyTable
ALTER COLUMN Column1 [TYPE] COLLATE [NewCollation]
Still is there a way to do that using SQL Server Management Studio?
Right-click on table name and choose Design. Then select column and go to Collation in column properties tab (inside Table Designer group).
Related
Is it possibile to have databae-wide settings to make sql queries case-sensitive on Microsoft SQL Server, e.g. 2012?
I'm refering to http://vyaskn.tripod.com/case_sensitive_search_in_sql_server.htm and it turn out for me that I can only modify queries to handle collations per column or to modify schema for specific columns have case-sensitive collations.
If I try
"ALTER DATABASE my_database COLLATE SQL_Latin1_General_CP1_CS_AS;"
it is not helping. Instead I have a problem with column names in my queries. I'm wonderign if there are separate settings for column name and data case-sensitivity for Ms SQL Server?
In SQL Server 2014 Management Studio:
Unable move (click and drag) columns(priority) in table
Unable to drag relation (between tables) in 'database diagram'
The order of the columns in a table does not have any bearing on "priority". More importantly, the ordering of the columns in a table shouldn't have any significance to your application, the database, or your queries.
IOW, there's no reason to move them around unless you're querying your database with select * and addressing the fields in the result set by ordinals (fields[0],fields[1], etc.).
I'm running SQL Server 2008R2 Standard edition on and RDS instance. I need to change the server's collation.So how can i change?
Based on documentation:
Amazon RDS creates a default server collation for character sets when
a SQL Server DB instance is created. This default server collation is
currently English (United States), or more precisely,
SQL_Latin1_General_CP1_CI_AS.
You can change the default collation at the database, table, or column level by overriding the collation when creating a new database or database object. For example, you can change from the default collation SQL_Latin1_General_CP1_CI_AS to Japanese_CI_AS for Japanese collation support. Even arguments in a query can be type-cast to use a different collation if necessary.
So change to desired collation on
database
ALTER DATABASE db_name
COLLATE collate_name;
column
ALTER TABLE dbo.table_name ALTER COLUMN col_name
type COLLATE collate_name;
My SQL Server query analyzer raises an error when I type my table names with lower-case letters.
My server and database collations are SQL_Latin1_General_CP1254_CI_AS.
Despite of it, Select * from table raises an error, while Select * From TABLE doesn't raise any error.
Where I am wrong? How can I make case-insensitive? I use SQL Server 2008
Give "select * from [table]" a try. And this is a silly question but is the name of the table, table?
Your server has a case insensitive collation, but each individual database may have its own collation. As it happens, this particular database has a case sensitive collation. If not explicitly specified (see CREATE DATABASE ... COLLATE ...) databases inherit the collation of the server they were originally created on. Likely this database was created on a server that had case sensitive collation and then attached/restored on your server.
the current database collation can be seen, for each database, in sys.databases:
select collation_name
from sys.databases
where database_id = db_id('...');
I have a table which has no identity column. I want to change a column's identity specification, but SQL Server 2008 doesn't allow that. So, how can I change identity property in SQL Server 2008?
under tools-->options-->designers-->table and database designers
uncheck prevent saving changes that require table re-creation
If you want to add a new column as an identity column:
ALTER TABLE [tablename] ADD COLUMN [columnName] int NOT NULL IDENTITY(1,1)
GO
ALTER TABLE [tablename] ADD PRIMARY KEY ([columnName])
If you're trying to use the SQL 2008 designer, there is a setting you have to disable so that the designer can drop and recreate the table.