Connection Strings for SQL Server
- Category: SQL Server
- Hits: 23343
MySQL Connector/Net
Type: .NET Framework Class LibraryUsage: MySql.Data.MySqlClient.MySqlConnection
Manufacturer: MySQL
Standard
Server=myServerAddress;Database=myDataBase;Uid=myUsername;Pwd=myPassword;Default port is 3306.
Specifying port
Server=myServerAddress;Port=1234;Database=myDataBase;Uid=myUsername;Pwd=myPassword;
Include a carriage return in a column heading
- Category: SQL Server
- Hits: 12465
- MS SQL Server 2008 R2
- MS Windows 7 Enterprise (Client)
- MS Excel 2010
What?
A really quick note on how to insert a carriage return or new line into the column name/alias (the header). It might seem trivial but these little aesthetic changes done at the database level can save some time.
Why?
I have an Excel report which dynamically gets its content from a data source located on a database on the other side of the world. I want the header in the column "Academic Week" to break across two lines so that the column doesn't expand to the width of "Academic Week" and instead expands to the width of the word "Academic".
What I have:
Academic Week Monday Tuesday Wednesday Thursday Friday ---------------- ----------- ----------- ----------- ----------- ----------- 1 14-Jul-2014 15-Jul-2014 16-Jul-2014 17-Jul-2014 18-Jul-2014 2 21-Jul-2014 22-Jul-2014 23-Jul-2014 24-Jul-2014 25-Jul-2014 ...What I want:
Academic Week Monday Tuesday Wednesday Thursday Friday --------- ----------- ----------- ----------- ----------- ----------- 1 14-Jul-2014 15-Jul-2014 16-Jul-2014 17-Jul-2014 18-Jul-2014 2 21-Jul-2014 22-Jul-2014 23-Jul-2014 24-Jul-2014 25-Jul-2014 ...
How?
To do this in a select query resultset, you insert the special character references "CHAR(10)" [line feed] and "CHAR(13)" [carriage return] but to do this in the name of the column heading, the answer is a much simpler one,