Showing posts with label output. Show all posts
Showing posts with label output. Show all posts

Monday, March 12, 2012

Mgmt Studio: Script Table as...

Hi,

I'm using SQL Server 2005 Express SP1 & Mgmt Studio express.

I'm trying to use the script output to track my db changes in source code mgmt, but when I output a table to a script the first two bytes of the "text" file are 0xFF and 0xFE which sends my SCM into storingthe file in binary defeating the purpose of storing text files I can "diff" to see the changes.

Does anyone know why the mgmt studio is doing this and is there a way to stop it?

thanks!

Management Studio creates UNICODE files so characters from all alphabets can be represented in the same file. Your SCM system is probably interpretting the UNICODE signature at the top of the file as being "binary."

If you are scripting to a Query Editor Window, you can save the script as an ASCII file by clicking File | Save As... and clicking the little pull-down arrow on the right side of the save button to select the file type. US-ASCII is toward the bottom of the list.

Hope this helps,
Steve

|||

Thanks! This was helpful and it explains the situation.

I'm working around it by the copy & paste method you mention while I deal with the SCM issue.

It's interesting that SQL Server Mgmt Studio uses unicode BOM and Visual Studio uses utf-8 for it's configuration files, so the SCM has to deal with the many "standards" of unicode...

life was not mean't to be easy...

Wednesday, March 7, 2012

Meta Data Help Needed[:(]

Hi Guys,

I have a DataBase in which I have several Tables.

What I want is an SP or Query which takes as its parameter the "tablename".

The Output Should be a having three fields only.

Field name, DataType Of the Field, Length of the DataType.

For Example

Suppose the StoredProcedure Name is "SP_GetTables"

if i have a table named "tbl_Users" with fields

UserName varchar(50)

UserPass varchar(20)

UserAge int

UserStatus bit

In my program side if I pass the parameter as "tbl_Users" to the StoredProcedure SP_Users,

I should get the O/P as

Field Name DataType Length

UserName varchar 50

UserPass varchar 20

UserAge int

UserStatus bit

Regards,

Naveen.

Here it is,


Createproc SP_GetTables(@.TableNameSysname)
as
Begin
Select
column_name [field name]
, data_type [datatype]
, character_maximum_length [length]
From
INFORMATION_SCHEMA.COLUMNS
Where
table_name= @.tablename
Orderby
ordinal_position
End

|||

HiManivannna.D.Sekaran,

Thanks a lot!!!

Is there a way by which I can pass the DataBase name too.

My requirement is like this.

I want an SP where i can pass DBName and Table Name as Parameters and that SP finds the DB and the table inside it.

The SP must reside in My DB too.

Regards,

Naveen

|||

Createproc SP_GetTables(@.TableNameSysname, @.databaseSysname)
as
Begin
Exec('Select
column_name [field name]
, data_type [datatype]
, character_maximum_length [length]
From
['+ @.database+'].INFORMATION_SCHEMA.COLUMNS
Where
table_name = '''+ @.tablename+'''
Order by
ordinal_position')
End

Saturday, February 25, 2012

message output from XSLT XML Task

Where does output from <xsl:message> stylesheet elements go? It's not in the Progress or Output window, and there doesn't seem to be a property that controls the destination for messages.

Kevin Rodgers wrote:

Where does output from <xsl:message> stylesheet elements go? It's not in the Progress or Output window, and there doesn't seem to be a property that controls the destination for messages.

I have the same question.

The ability to see the output from <xsl:message> would partially make up for the inability to set breakpoints in XSLT.

|||

Hi Kevin,

Interestingly enough, they go to standard output, which is really only visible if you're running dtexec directly. This is the default of the underlying System.Xml.Xsl engine, which the XML Task's XSLT operation is based on.

-David

|||

David, as I'm sure you know, it's possible for code to capture the output ot <xsl:message/>, and to send the output whereever it likes.

Good tip on standard output, though.

Monday, February 20, 2012

message output from XSLT XML Task

Where does output from <xsl:message> stylesheet elements go? It's not in the Progress or Output window, and there doesn't seem to be a property that controls the destination for messages.

Kevin Rodgers wrote:

Where does output from <xsl:message> stylesheet elements go? It's not in the Progress or Output window, and there doesn't seem to be a property that controls the destination for messages.

I have the same question.

The ability to see the output from <xsl:message> would partially make up for the inability to set breakpoints in XSLT.

|||

Hi Kevin,

Interestingly enough, they go to standard output, which is really only visible if you're running dtexec directly. This is the default of the underlying System.Xml.Xsl engine, which the XML Task's XSLT operation is based on.

-David

|||

David, as I'm sure you know, it's possible for code to capture the output ot <xsl:message/>, and to send the output whereever it likes.

Good tip on standard output, though.