Showing posts with label save. Show all posts
Showing posts with label save. Show all posts

Friday, March 9, 2012

How can the Profiler textdata field be enlarged?

When running Profiler to save a trace to a table the field 'TextData' gets
trunciated. The datatype for that field is as shown:

Column name | Data Type | Length | Allow Null

TextData ntext 16 yes

I can not find a way to set the trace up to create a tablewith TextData of
length greater than 16. This really causes a problem when trying to capture
long running queries for tuning as the query itself maybe truncated. Is
there a way around this?"Robert" <stop.spam@.boeing.com> wrote in message
news:HtAJF7.7yM@.news.boeing.com...
> When running Profiler to save a trace to a table the field 'TextData' gets
> trunciated. The datatype for that field is as shown:
> Column name | Data Type | Length | Allow Null
> TextData ntext 16 yes
>
> I can not find a way to set the trace up to create a tablewith TextData of
> length greater than 16. This really causes a problem when trying to
capture
> long running queries for tuning as the query itself maybe truncated. Is
> there a way around this?
>
ntext can store up to 1GB of Unicode text, so you should be able to see the
full query text. If not, perhaps you can clarify how you are viewing the
data? Using Query Analyzer, or another tool? QA displays only 256 characters
by default, so you may need to check your settings (Tools - Options -
Results).

By default, MSSQL stores a pointer to ntext data in the table, not the data
itself, which is where the 16 bytes comes from - that is the size of the
pointer only, not the data.

Simon|||"Simon Hayes" <sql@.hayes.ch> wrote in message
news:4033b59f$1_3@.news.bluewin.ch...
> "Robert" <stop.spam@.boeing.com> wrote in message
> news:HtAJF7.7yM@.news.boeing.com...
> > When running Profiler to save a trace to a table the field 'TextData'
gets
> > trunciated. The datatype for that field is as shown:
> > Column name | Data Type | Length | Allow Null
> > TextData ntext 16 yes
> > I can not find a way to set the trace up to create a tablewith TextData
of
> > length greater than 16. This really causes a problem when trying to
> capture
> > long running queries for tuning as the query itself maybe truncated. Is
> > there a way around this?
> ntext can store up to 1GB of Unicode text, so you should be able to see
the
> full query text. If not, perhaps you can clarify how you are viewing the
> data? Using Query Analyzer, or another tool? QA displays only 256
characters
> by default, so you may need to check your settings (Tools - Options -
> Results).
> By default, MSSQL stores a pointer to ntext data in the table, not the
data
> itself, which is where the 16 bytes comes from - that is the size of the
> pointer only, not the data.
> Simon

Thanx Simon

You nailed it! I am not worthy.

Wednesday, March 7, 2012

How can I write results of a query to output file and save it to the disk

Hi All,
Is there a way to write the results of a query to a file and save it to the
disk? I know that the SQL Query Analyzer gives us the option of 'results to
file'. I want to know whether I can write a script which can query the
database and redirect the results to a file, so that I can open the script
file thru SQL Query Analyzer and run it or even I can use this script in Job
Scheduling when I want.
Thanks,
NN> Is there a way to write the results of a query to a file and save it to
the
> disk? I know that the SQL Query Analyzer gives us the option of 'results
to
> file'. I want to know whether I can write a script which can query the
> database and redirect the results to a file, so that I can open the script
> file thru SQL Query Analyzer and run it or even I can use this script in
Job
> Scheduling when I want.
Just create a regular script, only T-SQL commands; you can run this commands
in QA, job task, or with OSQL.EXE command prompt utility. OSQL can save the
results to an output file. Check the parameters (specifically -i and -o) for
osql in Books onLine.
Dejan Sarka, SQL Server MVP
Associate Mentor
www.SolidQualityLearning.com|||Q: How can I read/write to a flat file from inside a SQL Server TSQL
script/stored-procedure/trigger?
A: http://www.mssqlserver.com/faq/general-flatfile.asp
HTH, Jens Smeyer.
http://www.sqlserver2005.de
--
"Nagaraju Nookala" <iranichai@.netscape.net> schrieb im Newsbeitrag
news:OU6DYFFRFHA.3296@.TK2MSFTNGP15.phx.gbl...
> Hi All,
> Is there a way to write the results of a query to a file and save it to
> the disk? I know that the SQL Query Analyzer gives us the option of
> 'results to file'. I want to know whether I can write a script which can
> query the database and redirect the results to a file, so that I can open
> the script file thru SQL Query Analyzer and run it or even I can use this
> script in Job Scheduling when I want.
> Thanks,
> NN
>