显示标签为“mssql”的博文。显示所有博文
显示标签为“mssql”的博文。显示所有博文

2012年3月11日星期日

Any T-SQL command can show the description of specified table columns?

I want to ask something because i need.

Any SQL/T-SQL command inside MsSQL Server 2000 can show the description of {all table columns or specified table columns} of specified table inside specified database?

can you teach me how to do and any example(s)?Try checking out the INFORMATION_SCHEMA.COLUMNS view:


SELECT
*
FROM
INFORMATION_SCHEMA.COLUMNS
WHERE
TABLE_CATALOG = 'myDatabase' AND
TABLE_NAME = 'myTable'

Terri|||You can also use the following:

exec sp_columns 'table_name'

This will return the list of columns for the table you specified.

2012年2月25日星期六

Any MySQL ENUM eqvivalent in MSSQL?

Hi,

Can't seem to find a similar data type in MSSQL like the one very handy ENUM type existing in e.g MySQL:

... Enum('on','off','standby') ...

It's also a convinient way to check for true/false. I'd appreciate any suggestions on possible "workarounds" or sources that might point me in the right direction.

Best

You could use a Rule or a Check Constraint.

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

2012年2月13日星期一

Any debugger in MSSQL 2005?

In SQL Server 2005, is there any debugging tools for T-SQL programming works similar to that in Visual Studio .NET?You have to use visual Studio to debug TSQL in SQL 2005. There is nothing in management studio.

Any backup vendor can provide?

Some of my customers ask for backup their databases, mainly MSSQL & MS Exchange.
I search for any of backup vendor; there are 2 choices, service provider and software publisher. Service provider eliminates my technical support on backing up my clients databases:cool: ; software publisher offer a chance for me to create new business line:rolleyes: .
What would your gurus prefer and why?
Any admirable company you can name?I back up MSSQL using MSSQL backup procedures.
MS Exchange is not a database server, so I don't know the best way to back it up.|||Thanks blindman.
How about the servers are Windows-based, some are Linux-based?|||As Blindman says, the easiest and best way to back up SQL databases is by using the built-in backup utilities that come with SQL Server.

Your server support team might want to include SQL Server boxes as part of their backup routine, in which case there are various applications that typically use an Agent to backup SQL Server databases either at a database or filesystem level, e.g. Veritas, Legato, Litespeed.

Bottom line; you as a DBA should be in charge of your database backups.

Lempster|||I have the same issue. However, FreeBSD adds to my heterogeneous environment.|||I was sourcing for such a solution earlier. I gathered info from other forums and identified some data backup solutions targeting ISPs and web hosting businesses like ours. Heres a list which Ive evaluated:

1. NovaNet (www.novastor.com)
2. Ahsay (www.ahsay.com)
3. Storgrid (www.vembu.com)
4. RBS (www.remote-backup.com)

Only Storegrid and Ahsay are multi-platform. I was lured into NovaNet with its attractive look. However, once I tested it on my server, I was disappointed with its instability. RBS is another piece of crappy software.

In the end I went with Ahsay and was pretty satisfied with it. Back up and restore worked as it says on the tin.

2012年2月9日星期四

ANSI to Unicode(MSSQL) convertions

Hi,
How to convert and transfer ANSI string data from FoxPro table to MS SQL
Unicode table. Data in FoxPro are in 1251 codepage (Russian Windows). Now
result is like " 100 ".The ODBC driver does not
performs the conversion from ANSI to Unicode.
Help.Does STRCONV() help?
-Anders
"Aras Kucinskas" <aras@.skuba.lt> wrote in message
news:Ot0I694AFHA.3708@.TK2MSFTNGP14.phx.gbl...
> Hi,
> How to convert and transfer ANSI string data from FoxPro table to MS SQL
> Unicode table. Data in FoxPro are in 1251 codepage (Russian Windows). Now
> result is like " 100 ".The ODBC driver does not
> performs the conversion from ANSI to Unicode.
> Help.
>|||MS SQL usually stores data in CP-1251 for ru_RU locale by default. Your
example here reads as "compressor ring 100 milimeters" in CP-1251 in fact.
Nevertheless, Activex script mechanism doesn't allow codepage translations,
as I was explained here some time ago. You probably need to add some VB /
VB.NET code to your DTS package. Of course, if you do need to translate your
strings.
Nick
"Aras Kucinskas" <aras@.skuba.lt> wrote in message
news:Ot0I694AFHA.3708@.TK2MSFTNGP14.phx.gbl...
> Hi,
> How to convert and transfer ANSI string data from FoxPro table to MS SQL
> Unicode table. Data in FoxPro are in 1251 codepage (Russian Windows).
Now
> result is like " 100 ".The ODBC driver does not
> performs the conversion from ANSI to Unicode.
> Help.
>|||Thanks Nick,
What functions I can use for string translation?
"Nikolai Lukin" <nvlukin@.gran-service.ru> wrote in message
news:35r898F4pjkqgU1@.individual.net...
> MS SQL usually stores data in CP-1251 for ru_RU locale by default. Your
> example here reads as "compressor ring 100 milimeters" in CP-1251 in fact.
> Nevertheless, Activex script mechanism doesn't allow codepage
translations,
> as I was explained here some time ago. You probably need to add some VB /
> VB.NET code to your DTS package. Of course, if you do need to translate
your
> strings.
> Nick
> "Aras Kucinskas" <aras@.skuba.lt> wrote in message
> news:Ot0I694AFHA.3708@.TK2MSFTNGP14.phx.gbl...
SQL
> Now
not
>|||SQL Server stores based on the codepage of the database!
For example:
If your client is using codepage 850 and the database 1250 you will have
automatic conversion.
If your client is using having a ASCII variable stored in codepage 850 and
your stored this in a Unicode column on the server, by default this will get
converted to the server side codepage first. You can also convert it to
Unicode on the client first and insert it, in which case it will got in as
is.
Please read:
International Features in Microsoft SQL Server 2000
http://msdn.microsoft.com/library/e...000.a
sp
PRB: SQL Server ODBC Driver Converts Language Events to Unicode (234748)
http://support.microsoft.com/defaul...KB;EN-US;234748
INF: SQL Server 7.0 BCP and Code Page Conversion (199819)
http://support.microsoft.com/defaul...KB;EN-US;199819
GertD@.SQLDev.Net
Please reply only to the newsgroups.
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.
Copyright SQLDev.Net 1991-2005 All rights reserved.
"Aras Kucinskas" <aras@.skuba.lt> wrote in message
news:O094iWDBFHA.2112@.TK2MSFTNGP09.phx.gbl...
> Thanks Nick,
> What functions I can use for string translation?
> "Nikolai Lukin" <nvlukin@.gran-service.ru> wrote in message
> news:35r898F4pjkqgU1@.individual.net...
> translations,
> your
> SQL
> not
>|||Here follows some portion of a VB.NET code provided "as is" with absolutely
no warranties. Functions translate a string variable from UTF-8 to ASCII
forth and back. Though code says for itself.
--Quote
Imports System.Text
Public utf8 As Encoding = utf8.UTF8
Public ascii As Encoding = ascii.Default
Public Function Utf8ToAscii(ByVal DataString As String) As String
If DataString = "" Then Return "" Else Return
utf8.GetString(ascii.GetBytes(DataString))
End Function
Public Function AsciiToUtf8(ByVal DataString As String) As String
If DataString = "" Then Return "" Else Return
ascii.GetString(utf8.GetBytes(DataString))
End Function
--Unquote
HTH
Nick
"Aras Kucinskas" <aras@.skuba.lt> wrote in message
news:O094iWDBFHA.2112@.TK2MSFTNGP09.phx.gbl...
> Thanks Nick,
> What functions I can use for string translation?
> "Nikolai Lukin" <nvlukin@.gran-service.ru> wrote in message
> news:35r898F4pjkqgU1@.individual.net...
> translations,
> your
> SQL
> not
>|||Sorry, this should read as:

> Imports System.Text
> Public utf8 As Encoding = utf8.UTF8
> Public ascii As Encoding = ascii.Default
> Public Function Utf8ToAscii(ByVal DataString As String) As String
> If DataString = "" Then Return "" Else Return
> utf8.GetString(ascii.GetBytes(DataString))
> End Function
> Public Function AsciiToUtf8(ByVal DataString As String) As String
> If DataString = "" Then Return "" Else Return
> ascii.GetString(utf8.GetBytes(DataString))
> End Function
Nick

ANSI to Unicode(MSSQL) convertions

Hi,
How to convert and transfer ANSI string data from FoxPro table to MS SQL
Unicode table. Data in FoxPro are in 1251 codepage (Russian Windows). Now
result is like " 100 ".The ODBC driver does not
performs the conversion from ANSI to Unicode.
Help.
Does STRCONV() help?
-Anders
"Aras Kucinskas" <aras@.skuba.lt> wrote in message
news:Ot0I694AFHA.3708@.TK2MSFTNGP14.phx.gbl...
> Hi,
> How to convert and transfer ANSI string data from FoxPro table to MS SQL
> Unicode table. Data in FoxPro are in 1251 codepage (Russian Windows). Now
> result is like " 100 ".The ODBC driver does not
> performs the conversion from ANSI to Unicode.
> Help.
>
|||MS SQL usually stores data in CP-1251 for ru_RU locale by default. Your
example here reads as "compressor ring 100 milimeters" in CP-1251 in fact.
Nevertheless, Activex script mechanism doesn't allow codepage translations,
as I was explained here some time ago. You probably need to add some VB /
VB.NET code to your DTS package. Of course, if you do need to translate your
strings.
Nick
"Aras Kucinskas" <aras@.skuba.lt> wrote in message
news:Ot0I694AFHA.3708@.TK2MSFTNGP14.phx.gbl...
> Hi,
> How to convert and transfer ANSI string data from FoxPro table to MS SQL
> Unicode table. Data in FoxPro are in 1251 codepage (Russian Windows).
Now
> result is like " 100 ".The ODBC driver does not
> performs the conversion from ANSI to Unicode.
> Help.
>
|||Thanks Nick,
What functions I can use for string translation?
"Nikolai Lukin" <nvlukin@.gran-service.ru> wrote in message
news:35r898F4pjkqgU1@.individual.net...
> MS SQL usually stores data in CP-1251 for ru_RU locale by default. Your
> example here reads as "compressor ring 100 milimeters" in CP-1251 in fact.
> Nevertheless, Activex script mechanism doesn't allow codepage
translations,
> as I was explained here some time ago. You probably need to add some VB /
> VB.NET code to your DTS package. Of course, if you do need to translate
your[vbcol=seagreen]
> strings.
> Nick
> "Aras Kucinskas" <aras@.skuba.lt> wrote in message
> news:Ot0I694AFHA.3708@.TK2MSFTNGP14.phx.gbl...
SQL[vbcol=seagreen]
> Now
not
>
|||SQL Server stores based on the codepage of the database!
For example:
If your client is using codepage 850 and the database 1250 you will have
automatic conversion.
If your client is using having a ASCII variable stored in codepage 850 and
your stored this in a Unicode column on the server, by default this will get
converted to the server side codepage first. You can also convert it to
Unicode on the client first and insert it, in which case it will got in as
is.
Please read:
International Features in Microsoft SQL Server 2000
http://msdn.microsoft.com/library/en...server2000.asp
PRB: SQL Server ODBC Driver Converts Language Events to Unicode (234748)
http://support.microsoft.com/default...B;EN-US;234748
INF: SQL Server 7.0 BCP and Code Page Conversion (199819)
http://support.microsoft.com/default...B;EN-US;199819
GertD@.SQLDev.Net
Please reply only to the newsgroups.
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.
Copyright SQLDev.Net 1991-2005 All rights reserved.
"Aras Kucinskas" <aras@.skuba.lt> wrote in message
news:O094iWDBFHA.2112@.TK2MSFTNGP09.phx.gbl...
> Thanks Nick,
> What functions I can use for string translation?
> "Nikolai Lukin" <nvlukin@.gran-service.ru> wrote in message
> news:35r898F4pjkqgU1@.individual.net...
> translations,
> your
> SQL
> not
>
|||Here follows some portion of a VB.NET code provided "as is" with absolutely
no warranties. Functions translate a string variable from UTF-8 to ASCII
forth and back. Though code says for itself.
--Quote
Imports System.Text
Public utf8 As Encoding = utf8.UTF8
Public ascii As Encoding = ascii.Default
Public Function Utf8ToAscii(ByVal DataString As String) As String
If DataString = "" Then Return "" Else Return
utf8.GetString(ascii.GetBytes(DataString))
End Function
Public Function AsciiToUtf8(ByVal DataString As String) As String
If DataString = "" Then Return "" Else Return
ascii.GetString(utf8.GetBytes(DataString))
End Function
--Unquote
HTH
Nick
"Aras Kucinskas" <aras@.skuba.lt> wrote in message
news:O094iWDBFHA.2112@.TK2MSFTNGP09.phx.gbl...
> Thanks Nick,
> What functions I can use for string translation?
> "Nikolai Lukin" <nvlukin@.gran-service.ru> wrote in message
> news:35r898F4pjkqgU1@.individual.net...
> translations,
> your
> SQL
> not
>
|||Sorry, this should read as:

> Imports System.Text
> Public utf8 As Encoding = utf8.UTF8
> Public ascii As Encoding = ascii.Default
> Public Function Utf8ToAscii(ByVal DataString As String) As String
> If DataString = "" Then Return "" Else Return
> utf8.GetString(ascii.GetBytes(DataString))
> End Function
> Public Function AsciiToUtf8(ByVal DataString As String) As String
> If DataString = "" Then Return "" Else Return
> ascii.GetString(utf8.GetBytes(DataString))
> End Function
Nick

ANSI to Unicode(MSSQL) convertions

Hi,
How to convert and transfer ANSI string data from FoxPro table to MS SQL
Unicode table. Data in FoxPro are in 1251 codepage (Russian Windows). Now
result is like " 100 ".The ODBC driver does not
performs the conversion from ANSI to Unicode.
Help.Does STRCONV() help?
-Anders
"Aras Kucinskas" <aras@.skuba.lt> wrote in message
news:Ot0I694AFHA.3708@.TK2MSFTNGP14.phx.gbl...
> Hi,
> How to convert and transfer ANSI string data from FoxPro table to MS SQL
> Unicode table. Data in FoxPro are in 1251 codepage (Russian Windows). Now
> result is like " 100 ".The ODBC driver does not
> performs the conversion from ANSI to Unicode.
> Help.
>|||MS SQL usually stores data in CP-1251 for ru_RU locale by default. Your
example here reads as "compressor ring 100 milimeters" in CP-1251 in fact.
Nevertheless, Activex script mechanism doesn't allow codepage translations,
as I was explained here some time ago. You probably need to add some VB /
VB.NET code to your DTS package. Of course, if you do need to translate your
strings.
Nick
"Aras Kucinskas" <aras@.skuba.lt> wrote in message
news:Ot0I694AFHA.3708@.TK2MSFTNGP14.phx.gbl...
> Hi,
> How to convert and transfer ANSI string data from FoxPro table to MS SQL
> Unicode table. Data in FoxPro are in 1251 codepage (Russian Windows).
Now
> result is like " 100 ".The ODBC driver does not
> performs the conversion from ANSI to Unicode.
> Help.
>|||Thanks Nick,
What functions I can use for string translation?
"Nikolai Lukin" <nvlukin@.gran-service.ru> wrote in message
news:35r898F4pjkqgU1@.individual.net...
> MS SQL usually stores data in CP-1251 for ru_RU locale by default. Your
> example here reads as "compressor ring 100 milimeters" in CP-1251 in fact.
> Nevertheless, Activex script mechanism doesn't allow codepage
translations,
> as I was explained here some time ago. You probably need to add some VB /
> VB.NET code to your DTS package. Of course, if you do need to translate
your
> strings.
> Nick
> "Aras Kucinskas" <aras@.skuba.lt> wrote in message
> news:Ot0I694AFHA.3708@.TK2MSFTNGP14.phx.gbl...
SQL[vbcol=seagreen]
> Now
not[vbcol=seagreen]
>|||SQL Server stores based on the codepage of the database!
For example:
If your client is using codepage 850 and the database 1250 you will have
automatic conversion.
If your client is using having a ASCII variable stored in codepage 850 and
your stored this in a Unicode column on the server, by default this will get
converted to the server side codepage first. You can also convert it to
Unicode on the client first and insert it, in which case it will got in as
is.
Please read:
International Features in Microsoft SQL Server 2000
http://msdn.microsoft.com/library/e...000.a
sp
PRB: SQL Server ODBC Driver Converts Language Events to Unicode (234748)
http://support.microsoft.com/defaul...KB;EN-US;234748
INF: SQL Server 7.0 BCP and Code Page Conversion (199819)
http://support.microsoft.com/defaul...KB;EN-US;199819
GertD@.SQLDev.Net
Please reply only to the newsgroups.
This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use.
Copyright SQLDev.Net 1991-2005 All rights reserved.
"Aras Kucinskas" <aras@.skuba.lt> wrote in message
news:O094iWDBFHA.2112@.TK2MSFTNGP09.phx.gbl...
> Thanks Nick,
> What functions I can use for string translation?
> "Nikolai Lukin" <nvlukin@.gran-service.ru> wrote in message
> news:35r898F4pjkqgU1@.individual.net...
> translations,
> your
> SQL
> not
>|||Here follows some portion of a VB.NET code provided "as is" with absolutely
no warranties. Functions translate a string variable from UTF-8 to ASCII
forth and back. Though code says for itself.
--Quote
Imports System.Text
Public utf8 As Encoding = utf8.UTF8
Public ascii As Encoding = ascii.Default
Public Function Utf8ToAscii(ByVal DataString As String) As String
If DataString = "" Then Return "" Else Return
utf8.GetString(ascii.GetBytes(DataString))
End Function
Public Function AsciiToUtf8(ByVal DataString As String) As String
If DataString = "" Then Return "" Else Return
ascii.GetString(utf8.GetBytes(DataString))
End Function
--Unquote
HTH
Nick
"Aras Kucinskas" <aras@.skuba.lt> wrote in message
news:O094iWDBFHA.2112@.TK2MSFTNGP09.phx.gbl...
> Thanks Nick,
> What functions I can use for string translation?
> "Nikolai Lukin" <nvlukin@.gran-service.ru> wrote in message
> news:35r898F4pjkqgU1@.individual.net...
> translations,
> your
> SQL
> not
>|||Sorry, this should read as:

> Imports System.Text
> Public utf8 As Encoding = utf8.UTF8
> Public ascii As Encoding = ascii.Default
> Public Function Utf8ToAscii(ByVal DataString As String) As String
> If DataString = "" Then Return "" Else Return
> utf8.GetString(ascii.GetBytes(DataString))
> End Function
> Public Function AsciiToUtf8(ByVal DataString As String) As String
> If DataString = "" Then Return "" Else Return
> ascii.GetString(utf8.GetBytes(DataString))
> End Function
Nick

ANSI Standards

We are in the process of migrating our MS SQL Server 2000 databases to MS
SQL Server 2005.
We have using the MS Upgrade Advisor to flag problems in our databases so
they can be fixed. Does there exist a tool from which we can get a report on
which databases contain components (tables, columns, stored procedures) that
do not meet ANSI standards?You can try Best Practices Analyzer tool for SQL Server 2000 by Microsoft ..
here is the link to download page:
http://www.microsoft.com/downloads/...&displaylang=en
"Loren Z" wrote:

> We are in the process of migrating our MS SQL Server 2000 databases to MS
> SQL Server 2005.
> We have using the MS Upgrade Advisor to flag problems in our databases so
> they can be fixed. Does there exist a tool from which we can get a report
on
> which databases contain components (tables, columns, stored procedures) th
at
> do not meet ANSI standards?
>
>