Showing posts with label file. Show all posts
Showing posts with label file. Show all posts

Wednesday, March 7, 2012

carry database of 2000 to new computer with SQL Server 2005

>I used "detach" in old computer with running SQL SERVER 2000 and copy the
> A.MDF file to the new computer with SQL Server 2005.
OK, should be fine.

> Then used "attach" to restore the database A in the new computer. The
> database A still keeps the user names and machine name. I can not delete them.
User names are expected. Yes, you can remove these if you wish. Check out DROP USER.
SQL Server does not store the machine name inside the database, except for the master and msdb
databases.

> The problem is that I can not expand the folder of Database Diagrams. When I
> do it, I got the message:
> Database diagram support objects cannot be installed because this database
> does not have a valid owner. To continue, first use the Files page of
> Database Properties dialog box or the ALTER AUTHORIZATION statement to set
> the database owner to a valid login, then add the database diagram support
> objects.
You need to set the owner to a login that exists as a login inside SQL Server. After that is done
(and restart SSMS just in case), SSMS will add the procedures etc automatically.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"david" <david@.discussions.microsoft.com> wrote in message
news:4838E101-064B-4658-8F73-85696E7FB195@.microsoft.com...
>I used "detach" in old computer with running SQL SERVER 2000 and copy the
> A.MDF file to the new computer with SQL Server 2005.
> Then used "attach" to restore the database A in the new computer. The
> database A still keeps the user names and machine name. I can not delete them.
> The problem is that I can not expand the folder of Database Diagrams. When I
> do it, I got the message:
> Database diagram support objects cannot be installed because this database
> does not have a valid owner. To continue, first use the Files page of
> Database Properties dialog box or the ALTER AUTHORIZATION statement to set
> the database owner to a valid login, then add the database diagram support
> objects.
> I did the "use the Files page of Database Properties dialog box to to set
> the database owner to a valid login", by using a new computer valid user
> name. But it does not work. I do not know how "then add the database diagram
> support objects" either.
> Thanks for any help.
> Dabin
IT seems you did set the owner to a valid login. You could try to set the owner to "sa" and see if
that helps. If not, I'm out of ideas, I'm afraid.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"david" <david@.discussions.microsoft.com> wrote in message
news:7F6BE323-F22F-42E1-846F-3CB685913381@.microsoft.com...[vbcol=seagreen]
> Thank you, Tibor:
> My problem is the last one "You need to set the owner to a login that exists
> as a login inside SQL Server. After that is done
> (and restart SSMS just in case), SSMS will add the procedures etc
> automatically.
> --
> "
> I did something wrong.
> I login to computer system, computer, by using my account, for example,
> david. So the full name: computer\david.
> I used SSMS to connect the database dbase. I right click on the database and
> select the Properties. In the popup window, select Files. In the owner bos,
> browser my account name, computer\david. Then click OK.
> Restart SSMS. Tried to open the database diagrams, and I got the same error
> massage.
> David
> "Tibor Karaszi" wrote:
|||Hi David,
I got the same error and fixed it by
right click on database
properties
files
options
Then change the compatibility from 80 which is SQL2000 to 90 which is
SQL2005.
"Tibor Karaszi" wrote:

> IT seems you did set the owner to a valid login. You could try to set the owner to "sa" and see if
> that helps. If not, I'm out of ideas, I'm afraid.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "david" <david@.discussions.microsoft.com> wrote in message
> news:7F6BE323-F22F-42E1-846F-3CB685913381@.microsoft.com...
>

carry database of 2000 to new computer with SQL Server 2005

I used "detach" in old computer with running SQL SERVER 2000 and copy the
A.MDF file to the new computer with SQL Server 2005.
Then used "attach" to restore the database A in the new computer. The
database A still keeps the user names and machine name. I can not delete them.
The problem is that I can not expand the folder of Database Diagrams. When I
do it, I got the message:
Database diagram support objects cannot be installed because this database
does not have a valid owner. To continue, first use the Files page of
Database Properties dialog box or the ALTER AUTHORIZATION statement to set
the database owner to a valid login, then add the database diagram support
objects.
I did the "use the Files page of Database Properties dialog box to to set
the database owner to a valid login", by using a new computer valid user
name. But it does not work. I do not know how "then add the database diagram
support objects" either.
Thanks for any help.
Dabin>I used "detach" in old computer with running SQL SERVER 2000 and copy the
> A.MDF file to the new computer with SQL Server 2005.
OK, should be fine.
> Then used "attach" to restore the database A in the new computer. The
> database A still keeps the user names and machine name. I can not delete them.
User names are expected. Yes, you can remove these if you wish. Check out DROP USER.
SQL Server does not store the machine name inside the database, except for the master and msdb
databases.
> The problem is that I can not expand the folder of Database Diagrams. When I
> do it, I got the message:
> Database diagram support objects cannot be installed because this database
> does not have a valid owner. To continue, first use the Files page of
> Database Properties dialog box or the ALTER AUTHORIZATION statement to set
> the database owner to a valid login, then add the database diagram support
> objects.
You need to set the owner to a login that exists as a login inside SQL Server. After that is done
(and restart SSMS just in case), SSMS will add the procedures etc automatically.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"david" <david@.discussions.microsoft.com> wrote in message
news:4838E101-064B-4658-8F73-85696E7FB195@.microsoft.com...
>I used "detach" in old computer with running SQL SERVER 2000 and copy the
> A.MDF file to the new computer with SQL Server 2005.
> Then used "attach" to restore the database A in the new computer. The
> database A still keeps the user names and machine name. I can not delete them.
> The problem is that I can not expand the folder of Database Diagrams. When I
> do it, I got the message:
> Database diagram support objects cannot be installed because this database
> does not have a valid owner. To continue, first use the Files page of
> Database Properties dialog box or the ALTER AUTHORIZATION statement to set
> the database owner to a valid login, then add the database diagram support
> objects.
> I did the "use the Files page of Database Properties dialog box to to set
> the database owner to a valid login", by using a new computer valid user
> name. But it does not work. I do not know how "then add the database diagram
> support objects" either.
> Thanks for any help.
> Dabin|||Thank you, Tibor:
My problem is the last one "You need to set the owner to a login that exists
as a login inside SQL Server. After that is done
(and restart SSMS just in case), SSMS will add the procedures etc
automatically.
--
"
I did something wrong.
I login to computer system, computer, by using my account, for example,
david. So the full name: computer\david.
I used SSMS to connect the database dbase. I right click on the database and
select the Properties. In the popup window, select Files. In the owner bos,
browser my account name, computer\david. Then click OK.
Restart SSMS. Tried to open the database diagrams, and I got the same error
massage.
David
"Tibor Karaszi" wrote:
> >I used "detach" in old computer with running SQL SERVER 2000 and copy the
> > A.MDF file to the new computer with SQL Server 2005.
> OK, should be fine.
>
> > Then used "attach" to restore the database A in the new computer. The
> > database A still keeps the user names and machine name. I can not delete them.
> User names are expected. Yes, you can remove these if you wish. Check out DROP USER.
> SQL Server does not store the machine name inside the database, except for the master and msdb
> databases.
>
> > The problem is that I can not expand the folder of Database Diagrams. When I
> > do it, I got the message:
> > Database diagram support objects cannot be installed because this database
> > does not have a valid owner. To continue, first use the Files page of
> > Database Properties dialog box or the ALTER AUTHORIZATION statement to set
> > the database owner to a valid login, then add the database diagram support
> > objects.
> You need to set the owner to a login that exists as a login inside SQL Server. After that is done
> (and restart SSMS just in case), SSMS will add the procedures etc automatically.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "david" <david@.discussions.microsoft.com> wrote in message
> news:4838E101-064B-4658-8F73-85696E7FB195@.microsoft.com...
> >I used "detach" in old computer with running SQL SERVER 2000 and copy the
> > A.MDF file to the new computer with SQL Server 2005.
> > Then used "attach" to restore the database A in the new computer. The
> > database A still keeps the user names and machine name. I can not delete them.
> >
> > The problem is that I can not expand the folder of Database Diagrams. When I
> > do it, I got the message:
> > Database diagram support objects cannot be installed because this database
> > does not have a valid owner. To continue, first use the Files page of
> > Database Properties dialog box or the ALTER AUTHORIZATION statement to set
> > the database owner to a valid login, then add the database diagram support
> > objects.
> >
> > I did the "use the Files page of Database Properties dialog box to to set
> > the database owner to a valid login", by using a new computer valid user
> > name. But it does not work. I do not know how "then add the database diagram
> > support objects" either.
> >
> > Thanks for any help.
> >
> > Dabin
>|||IT seems you did set the owner to a valid login. You could try to set the owner to "sa" and see if
that helps. If not, I'm out of ideas, I'm afraid.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"david" <david@.discussions.microsoft.com> wrote in message
news:7F6BE323-F22F-42E1-846F-3CB685913381@.microsoft.com...
> Thank you, Tibor:
> My problem is the last one "You need to set the owner to a login that exists
> as a login inside SQL Server. After that is done
> (and restart SSMS just in case), SSMS will add the procedures etc
> automatically.
> --
> "
> I did something wrong.
> I login to computer system, computer, by using my account, for example,
> david. So the full name: computer\david.
> I used SSMS to connect the database dbase. I right click on the database and
> select the Properties. In the popup window, select Files. In the owner bos,
> browser my account name, computer\david. Then click OK.
> Restart SSMS. Tried to open the database diagrams, and I got the same error
> massage.
> David
> "Tibor Karaszi" wrote:
>> >I used "detach" in old computer with running SQL SERVER 2000 and copy the
>> > A.MDF file to the new computer with SQL Server 2005.
>> OK, should be fine.
>>
>> > Then used "attach" to restore the database A in the new computer. The
>> > database A still keeps the user names and machine name. I can not delete them.
>> User names are expected. Yes, you can remove these if you wish. Check out DROP USER.
>> SQL Server does not store the machine name inside the database, except for the master and msdb
>> databases.
>>
>> > The problem is that I can not expand the folder of Database Diagrams. When I
>> > do it, I got the message:
>> > Database diagram support objects cannot be installed because this database
>> > does not have a valid owner. To continue, first use the Files page of
>> > Database Properties dialog box or the ALTER AUTHORIZATION statement to set
>> > the database owner to a valid login, then add the database diagram support
>> > objects.
>> You need to set the owner to a login that exists as a login inside SQL Server. After that is done
>> (and restart SSMS just in case), SSMS will add the procedures etc automatically.
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://sqlblog.com/blogs/tibor_karaszi
>>
>> "david" <david@.discussions.microsoft.com> wrote in message
>> news:4838E101-064B-4658-8F73-85696E7FB195@.microsoft.com...
>> >I used "detach" in old computer with running SQL SERVER 2000 and copy the
>> > A.MDF file to the new computer with SQL Server 2005.
>> > Then used "attach" to restore the database A in the new computer. The
>> > database A still keeps the user names and machine name. I can not delete them.
>> >
>> > The problem is that I can not expand the folder of Database Diagrams. When I
>> > do it, I got the message:
>> > Database diagram support objects cannot be installed because this database
>> > does not have a valid owner. To continue, first use the Files page of
>> > Database Properties dialog box or the ALTER AUTHORIZATION statement to set
>> > the database owner to a valid login, then add the database diagram support
>> > objects.
>> >
>> > I did the "use the Files page of Database Properties dialog box to to set
>> > the database owner to a valid login", by using a new computer valid user
>> > name. But it does not work. I do not know how "then add the database diagram
>> > support objects" either.
>> >
>> > Thanks for any help.
>> >
>> > Dabin|||Hi David,
I got the same error and fixed it by
right click on database
properties
files
options
Then change the compatibility from 80 which is SQL2000 to 90 which is
SQL2005.
"Tibor Karaszi" wrote:
> IT seems you did set the owner to a valid login. You could try to set the owner to "sa" and see if
> that helps. If not, I'm out of ideas, I'm afraid.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "david" <david@.discussions.microsoft.com> wrote in message
> news:7F6BE323-F22F-42E1-846F-3CB685913381@.microsoft.com...
> > Thank you, Tibor:
> > My problem is the last one "You need to set the owner to a login that exists
> > as a login inside SQL Server. After that is done
> > (and restart SSMS just in case), SSMS will add the procedures etc
> > automatically.
> > --
> > "
> >
> > I did something wrong.
> > I login to computer system, computer, by using my account, for example,
> > david. So the full name: computer\david.
> > I used SSMS to connect the database dbase. I right click on the database and
> > select the Properties. In the popup window, select Files. In the owner bos,
> > browser my account name, computer\david. Then click OK.
> > Restart SSMS. Tried to open the database diagrams, and I got the same error
> > massage.
> >
> > David
> >
> > "Tibor Karaszi" wrote:
> >
> >> >I used "detach" in old computer with running SQL SERVER 2000 and copy the
> >> > A.MDF file to the new computer with SQL Server 2005.
> >>
> >> OK, should be fine.
> >>
> >>
> >> > Then used "attach" to restore the database A in the new computer. The
> >> > database A still keeps the user names and machine name. I can not delete them.
> >>
> >> User names are expected. Yes, you can remove these if you wish. Check out DROP USER.
> >> SQL Server does not store the machine name inside the database, except for the master and msdb
> >> databases.
> >>
> >>
> >> > The problem is that I can not expand the folder of Database Diagrams. When I
> >> > do it, I got the message:
> >> > Database diagram support objects cannot be installed because this database
> >> > does not have a valid owner. To continue, first use the Files page of
> >> > Database Properties dialog box or the ALTER AUTHORIZATION statement to set
> >> > the database owner to a valid login, then add the database diagram support
> >> > objects.
> >>
> >> You need to set the owner to a login that exists as a login inside SQL Server. After that is done
> >> (and restart SSMS just in case), SSMS will add the procedures etc automatically.
> >> --
> >> Tibor Karaszi, SQL Server MVP
> >> http://www.karaszi.com/sqlserver/default.asp
> >> http://sqlblog.com/blogs/tibor_karaszi
> >>
> >>
> >> "david" <david@.discussions.microsoft.com> wrote in message
> >> news:4838E101-064B-4658-8F73-85696E7FB195@.microsoft.com...
> >> >I used "detach" in old computer with running SQL SERVER 2000 and copy the
> >> > A.MDF file to the new computer with SQL Server 2005.
> >> > Then used "attach" to restore the database A in the new computer. The
> >> > database A still keeps the user names and machine name. I can not delete them.
> >> >
> >> > The problem is that I can not expand the folder of Database Diagrams. When I
> >> > do it, I got the message:
> >> > Database diagram support objects cannot be installed because this database
> >> > does not have a valid owner. To continue, first use the Files page of
> >> > Database Properties dialog box or the ALTER AUTHORIZATION statement to set
> >> > the database owner to a valid login, then add the database diagram support
> >> > objects.
> >> >
> >> > I did the "use the Files page of Database Properties dialog box to to set
> >> > the database owner to a valid login", by using a new computer valid user
> >> > name. But it does not work. I do not know how "then add the database diagram
> >> > support objects" either.
> >> >
> >> > Thanks for any help.
> >> >
> >> > Dabin
> >>
>

carry database of 2000 to new computer with SQL Server 2005

I used "detach" in old computer with running SQL SERVER 2000 and copy the
A.MDF file to the new computer with SQL Server 2005.
Then used "attach" to restore the database A in the new computer. The
database A still keeps the user names and machine name. I can not delete the
m.
The problem is that I can not expand the folder of Database Diagrams. When I
do it, I got the message:
Database diagram support objects cannot be installed because this database
does not have a valid owner. To continue, first use the Files page of
Database Properties dialog box or the ALTER AUTHORIZATION statement to set
the database owner to a valid login, then add the database diagram support
objects.
I did the "use the Files page of Database Properties dialog box to to set
the database owner to a valid login", by using a new computer valid user
name. But it does not work. I do not know how "then add the database diagram
support objects" either.
Thanks for any help.
Dabin>I used "detach" in old computer with running SQL SERVER 2000 and copy the
> A.MDF file to the new computer with SQL Server 2005.
OK, should be fine.

> Then used "attach" to restore the database A in the new computer. The
> database A still keeps the user names and machine name. I can not delete them.[/vb
col]
User names are expected. Yes, you can remove these if you wish. Check out DR
OP USER.
SQL Server does not store the machine name inside the database, except for t
he master and msdb
databases.
[vbcol=seagreen]
> The problem is that I can not expand the folder of Database Diagrams. When
I
> do it, I got the message:
> Database diagram support objects cannot be installed because this database
> does not have a valid owner. To continue, first use the Files page of
> Database Properties dialog box or the ALTER AUTHORIZATION statement to set
> the database owner to a valid login, then add the database diagram support
> objects.
You need to set the owner to a login that exists as a login inside SQL Serve
r. After that is done
(and restart SSMS just in case), SSMS will add the procedures etc automatica
lly.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"david" <david@.discussions.microsoft.com> wrote in message
news:4838E101-064B-4658-8F73-85696E7FB195@.microsoft.com...
>I used "detach" in old computer with running SQL SERVER 2000 and copy the
> A.MDF file to the new computer with SQL Server 2005.
> Then used "attach" to restore the database A in the new computer. The
> database A still keeps the user names and machine name. I can not delete t
hem.
> The problem is that I can not expand the folder of Database Diagrams. When
I
> do it, I got the message:
> Database diagram support objects cannot be installed because this database
> does not have a valid owner. To continue, first use the Files page of
> Database Properties dialog box or the ALTER AUTHORIZATION statement to set
> the database owner to a valid login, then add the database diagram support
> objects.
> I did the "use the Files page of Database Properties dialog box to to set
> the database owner to a valid login", by using a new computer valid user
> name. But it does not work. I do not know how "then add the database diagr
am
> support objects" either.
> Thanks for any help.
> Dabin|||Thank you, Tibor:
My problem is the last one "You need to set the owner to a login that exists
as a login inside SQL Server. After that is done
(and restart SSMS just in case), SSMS will add the procedures etc
automatically.
--
"
I did something wrong.
I login to computer system, computer, by using my account, for example,
david. So the full name: computer\david.
I used SSMS to connect the database dbase. I right click on the database and
select the Properties. In the popup window, select Files. In the owner bos,
browser my account name, computer\david. Then click OK.
Restart SSMS. Tried to open the database diagrams, and I got the same error
massage.
David
"Tibor Karaszi" wrote:

> OK, should be fine.
>
> User names are expected. Yes, you can remove these if you wish. Check out
DROP USER.
> SQL Server does not store the machine name inside the database, except for
the master and msdb
> databases.
>
> You need to set the owner to a login that exists as a login inside SQL Ser
ver. After that is done
> (and restart SSMS just in case), SSMS will add the procedures etc automati
cally.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "david" <david@.discussions.microsoft.com> wrote in message
> news:4838E101-064B-4658-8F73-85696E7FB195@.microsoft.com...
>|||IT seems you did set the owner to a valid login. You could try to set the ow
ner to "sa" and see if
that helps. If not, I'm out of ideas, I'm afraid.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://sqlblog.com/blogs/tibor_karaszi
"david" <david@.discussions.microsoft.com> wrote in message
news:7F6BE323-F22F-42E1-846F-3CB685913381@.microsoft.com...[vbcol=seagreen]
> Thank you, Tibor:
> My problem is the last one "You need to set the owner to a login that exis
ts
> as a login inside SQL Server. After that is done
> (and restart SSMS just in case), SSMS will add the procedures etc
> automatically.
> --
> "
> I did something wrong.
> I login to computer system, computer, by using my account, for example,
> david. So the full name: computer\david.
> I used SSMS to connect the database dbase. I right click on the database a
nd
> select the Properties. In the popup window, select Files. In the owner bos
,
> browser my account name, computer\david. Then click OK.
> Restart SSMS. Tried to open the database diagrams, and I got the same erro
r
> massage.
> David
> "Tibor Karaszi" wrote:
>|||Hi David,
I got the same error and fixed it by
right click on database
properties
files
options
Then change the compatibility from 80 which is SQL2000 to 90 which is
SQL2005.
"Tibor Karaszi" wrote:

> IT seems you did set the owner to a valid login. You could try to set the
owner to "sa" and see if
> that helps. If not, I'm out of ideas, I'm afraid.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://sqlblog.com/blogs/tibor_karaszi
>
> "david" <david@.discussions.microsoft.com> wrote in message
> news:7F6BE323-F22F-42E1-846F-3CB685913381@.microsoft.com...
>

Carriage return in header of Flat File Destination

I'm trying to create a flat file that has a header like:

/INST=-1
/DELIMITER=","
/FIELDS=FIELD1,FIELD2,FIELD3,FIELD4
/LOCATION=100
data,data,data,data
data,data,data,data

where 'data' represents the data written out by the data flow process to the flat file destination. This actually turns out quite nice except that when I place the lines that start with '/' in the header box for the flat file destination the carriage return doesn't get written correctly after each line and I end up with an unrecognized character when I open the file in a simple app like notepad. I've tried using different encodings for the flat file connection, but to no avail. It is also interesting to note that when I close the package and reopen it the flat file destination editor UI also doesn't recognize the carriage returns and places a box in there place.

Below is a copy of the the property as it is written in the package xml:

<property id="92" name="Header" dataType="System.String" state="default" isArray="false" description="Specifies the text to write to the destination file before any data is written." typeConverter="" UITypeEditor="" containsID="false" expressionType="Notify">/INST=-1
/DELIMITER=","
/FIELDS=FIELD1,FIELD2,FIELD3,FIELD4
/LOCATION=100</property>

Any help is appreciated.

-dotnetwiz

I was able to do this using a property expression on the 'header' property (accessed via expressions of the dataflow task).
When I reversed the order of \r\n to \n\r I do get some messages about inconsistent line delimeters in some editors.

"/INST=-1\r\n"
+"/DELIMITER=\",\"\r\n"
+"/FIELDS=FIELD1,FIELD2,FIELD3,FIELD4\r\n"
+"/LOCATION=100\r\n"

Hope this helps

|||How do you get to the "Expression" of the DataFlow task? Right-click does not list "expressions" as a menu item. The Advanced Editor does not provide any apparent access to "Expressions"...?|||In the control flow, right-click on the data flow task and select properties. Scroll down in that list and you'll see "Expressions."|||I'm trying to do something similar in setting up a header for a fixed width flat-file output. When I try to use \r\n after my text, the characters "\r\n" just show up in the header. How do I get a CR+LF? I've tried using ="mytext\r\n" and I just see that entire literal string, including the quotes, appear in the output.|||As Phil pointed out, on the Control Flow tab, you have a DataFlow component (which, when you edit it, leads to the DataFlow tab and displays components there). If you look at the properties for the object on the control tab, one of them is "Expressions" and you can open it to get at the properties of the components on the Dataflow tab (like header for a flat file destination.)

Setting the Expression to a quoted string allows you to include \r\n and they will be translated properly.

Carriage return in header of Flat File Destination

I'm trying to create a flat file that has a header like:

/INST=-1
/DELIMITER=","
/FIELDS=FIELD1,FIELD2,FIELD3,FIELD4
/LOCATION=100
data,data,data,data
data,data,data,data

where 'data' represents the data written out by the data flow process to the flat file destination. This actually turns out quite nice except that when I place the lines that start with '/' in the header box for the flat file destination the carriage return doesn't get written correctly after each line and I end up with an unrecognized character when I open the file in a simple app like notepad. I've tried using different encodings for the flat file connection, but to no avail. It is also interesting to note that when I close the package and reopen it the flat file destination editor UI also doesn't recognize the carriage returns and places a box in there place.

Below is a copy of the the property as it is written in the package xml:

<property id="92" name="Header" dataType="System.String" state="default" isArray="false" description="Specifies the text to write to the destination file before any data is written." typeConverter="" UITypeEditor="" containsID="false" expressionType="Notify">/INST=-1
/DELIMITER=","
/FIELDS=FIELD1,FIELD2,FIELD3,FIELD4
/LOCATION=100</property>

Any help is appreciated.

-dotnetwiz

I was able to do this using a property expression on the 'header' property (accessed via expressions of the dataflow task).
When I reversed the order of \r\n to \n\r I do get some messages about inconsistent line delimeters in some editors.

"/INST=-1\r\n"
+"/DELIMITER=\",\"\r\n"
+"/FIELDS=FIELD1,FIELD2,FIELD3,FIELD4\r\n"
+"/LOCATION=100\r\n"

Hope this helps

|||How do you get to the "Expression" of the DataFlow task? Right-click does not list "expressions" as a menu item. The Advanced Editor does not provide any apparent access to "Expressions"...?|||In the control flow, right-click on the data flow task and select properties. Scroll down in that list and you'll see "Expressions."|||I'm trying to do something similar in setting up a header for a fixed width flat-file output. When I try to use \r\n after my text, the characters "\r\n" just show up in the header. How do I get a CR+LF? I've tried using ="mytext\r\n" and I just see that entire literal string, including the quotes, appear in the output.|||As Phil pointed out, on the Control Flow tab, you have a DataFlow component (which, when you edit it, leads to the DataFlow tab and displays components there). If you look at the properties for the object on the control tab, one of them is "Expressions" and you can open it to get at the properties of the components on the Dataflow tab (like header for a flat file destination.)

Setting the Expression to a quoted string allows you to include \r\n and they will be translated properly.

Friday, February 24, 2012

Capturing database size on a schedule and graphing?

I'm wondering if there are any other programmers/DBA's out there that have
lots of databases that they need to routinely monitor its file growth over
time. I'm looking for any VB code or scripts that accomplish this.
We have about 500 SQL Server databases on one of our servers and they extend
daily.
I would like to capture their size and save the data so it can be graphed in
Excel or something to show the growth rate of each database.
If anyone has any sample code or idea how I can do some of this -- I would
appreciate it greatly.There are multiple ways you could do this.
One would be a scheduled job in SQL Server, which uses either the
undocumented sp_MSForEachDB or a cursor, loops through the databases, and
logs the result of sp_helpfile. This can be useful if you want to leave out
irrelevant databases using the where clause for the cursor or an if
conditional.
Another way would be a windows scheduled task that calls a VBS script, using
FileSystemObject to loop through all the MDF/NDF files and logs their size
property. This can be useful if all of your relevant databases are in a
specific location, separate from the system databases and/or other databases
you are not interested in logging.
If you can wait a day or two, I will whip something up that should be a bit
more concrete than the above... in the meantime, you could take a crack at
it, and post here if you have specific issues.
Let's narrow the discussion groups down though, okay?
http://www.aspfaq.com/
(Reverse address to reply.)
"DavidM" <spam@.spam.net> wrote in message
news:uBE#1Bb7EHA.2804@.TK2MSFTNGP15.phx.gbl...
> I'm wondering if there are any other programmers/DBA's out there that have
> lots of databases that they need to routinely monitor its file growth over
> time. I'm looking for any VB code or scripts that accomplish this.
> We have about 500 SQL Server databases on one of our servers and they
extend
> daily.
> I would like to capture their size and save the data so it can be graphed
in
> Excel or something to show the growth rate of each database.
> If anyone has any sample code or idea how I can do some of this -- I would
> appreciate it greatly.
>
>|||Hi
You may want to check out the code in sp_spaceused and adapt it to suit your
purposes.
John
"DavidM" <spam@.spam.net> wrote in message
news:uBE%231Bb7EHA.2804@.TK2MSFTNGP15.phx.gbl...
> I'm wondering if there are any other programmers/DBA's out there that have
> lots of databases that they need to routinely monitor its file growth over
> time. I'm looking for any VB code or scripts that accomplish this.
> We have about 500 SQL Server databases on one of our servers and they
> extend daily.
> I would like to capture their size and save the data so it can be graphed
> in Excel or something to show the growth rate of each database.
> If anyone has any sample code or idea how I can do some of this -- I would
> appreciate it greatly.
>
>|||...also sp_databases would probably do this if you don't want to split up
log and data files.
John
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:eR1GFfb7EHA.2804@.TK2MSFTNGP15.phx.gbl...
> Hi
> You may want to check out the code in sp_spaceused and adapt it to suit
> your purposes.
> John
> "DavidM" <spam@.spam.net> wrote in message
> news:uBE%231Bb7EHA.2804@.TK2MSFTNGP15.phx.gbl...
>|||There are some code can be used on this web site:
http://www.sqlservercentral.com/scr...ibutions/31.asp
I tried it, seems very nice.
Good luck
"DavidM" <spam@.spam.net> wrote in message
news:uBE%231Bb7EHA.2804@.TK2MSFTNGP15.phx.gbl...
> I'm wondering if there are any other programmers/DBA's out there that have
> lots of databases that they need to routinely monitor its file growth over
> time. I'm looking for any VB code or scripts that accomplish this.
> We have about 500 SQL Server databases on one of our servers and they
extend
> daily.
> I would like to capture their size and save the data so it can be graphed
in
> Excel or something to show the growth rate of each database.
> If anyone has any sample code or idea how I can do some of this -- I would
> appreciate it greatly.
>
>|||If I run a query on the .sysfiles table, the size column shows 1704. Is
this in pages? How do I convert to bytes or megabytes?
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:eR1GFfb7EHA.2804@.TK2MSFTNGP15.phx.gbl...
> Hi
> You may want to check out the code in sp_spaceused and adapt it to suit
> your purposes.
> John
> "DavidM" <spam@.spam.net> wrote in message
> news:uBE%231Bb7EHA.2804@.TK2MSFTNGP15.phx.gbl...
>|||> If I run a query on the .sysfiles table, the size column shows 1704. Is
> this in pages? How do I convert to bytes or megabytes?
SELECT
[Filename],
[SIZE IN KB] = size*8
FROM sysfiles|||Thanks for the reply. I was able to find
http://www.databasejournal.com/feat...cle.php/3339681 which
looks promising.
I got this to work but its a bit kludgy. Since I have a VB application that
we run daily, I'd like to incorporate the collection of stats within this
program.
Next question is, what is the best way to graph this data using Excel? Can
I have Excel read the database/table directory from SQL? If so, that is
what I want to do rather than create a .CSV file from SQL.
Opinions?
"Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:OG7fWJb7EHA.1408@.TK2MSFTNGP10.phx.gbl...
> There are multiple ways you could do this.
> One would be a scheduled job in SQL Server, which uses either the
> undocumented sp_MSForEachDB or a cursor, loops through the databases, and
> logs the result of sp_helpfile. This can be useful if you want to leave
> out
> irrelevant databases using the where clause for the cursor or an if
> conditional.
> Another way would be a windows scheduled task that calls a VBS script,
> using
> FileSystemObject to loop through all the MDF/NDF files and logs their size
> property. This can be useful if all of your relevant databases are in a
> specific location, separate from the system databases and/or other
> databases
> you are not interested in logging.
> If you can wait a day or two, I will whip something up that should be a
> bit
> more concrete than the above... in the meantime, you could take a crack at
> it, and post here if you have specific issues.
> Let's narrow the discussion groups down though, okay?
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>
>
> "DavidM" <spam@.spam.net> wrote in message
> news:uBE#1Bb7EHA.2804@.TK2MSFTNGP15.phx.gbl...
> extend
> in
>|||> Next question is, what is the best way to graph this data using Excel?
Have you considered using Reporting Services?|||or you might wish to setup a sql agent job to run at the end of each busines
s
day to collect the information and popuate a base table
-- try the simple but useful approach below
/** the following can be quite useful **/
select instance_name,cntr_value 'Size in (Kb)' from
master..sysperfinfo(nolock)
where object_name like '%databases%'
and counter_name = 'Data File(s) size (Kb)'
and instance_name not in ('_total') -- can include total to get a server
based overview
"DavidM" wrote:

> I'm wondering if there are any other programmers/DBA's out there that have
> lots of databases that they need to routinely monitor its file growth over
> time. I'm looking for any VB code or scripts that accomplish this.
> We have about 500 SQL Server databases on one of our servers and they exte
nd
> daily.
> I would like to capture their size and save the data so it can be graphed
in
> Excel or something to show the growth rate of each database.
> If anyone has any sample code or idea how I can do some of this -- I would
> appreciate it greatly.
>
>

Capturing database size on a schedule and graphing?

I'm wondering if there are any other programmers/DBA's out there that have
lots of databases that they need to routinely monitor its file growth over
time. I'm looking for any VB code or scripts that accomplish this.
We have about 500 SQL Server databases on one of our servers and they extend
daily.
I would like to capture their size and save the data so it can be graphed in
Excel or something to show the growth rate of each database.
If anyone has any sample code or idea how I can do some of this -- I would
appreciate it greatly.There are multiple ways you could do this.
One would be a scheduled job in SQL Server, which uses either the
undocumented sp_MSForEachDB or a cursor, loops through the databases, and
logs the result of sp_helpfile. This can be useful if you want to leave out
irrelevant databases using the where clause for the cursor or an if
conditional.
Another way would be a windows scheduled task that calls a VBS script, using
FileSystemObject to loop through all the MDF/NDF files and logs their size
property. This can be useful if all of your relevant databases are in a
specific location, separate from the system databases and/or other databases
you are not interested in logging.
If you can wait a day or two, I will whip something up that should be a bit
more concrete than the above... in the meantime, you could take a crack at
it, and post here if you have specific issues.
Let's narrow the discussion groups down though, okay?
--
http://www.aspfaq.com/
(Reverse address to reply.)
"DavidM" <spam@.spam.net> wrote in message
news:uBE#1Bb7EHA.2804@.TK2MSFTNGP15.phx.gbl...
> I'm wondering if there are any other programmers/DBA's out there that have
> lots of databases that they need to routinely monitor its file growth over
> time. I'm looking for any VB code or scripts that accomplish this.
> We have about 500 SQL Server databases on one of our servers and they
extend
> daily.
> I would like to capture their size and save the data so it can be graphed
in
> Excel or something to show the growth rate of each database.
> If anyone has any sample code or idea how I can do some of this -- I would
> appreciate it greatly.
>
>|||Hi
You may want to check out the code in sp_spaceused and adapt it to suit your
purposes.
John
"DavidM" <spam@.spam.net> wrote in message
news:uBE%231Bb7EHA.2804@.TK2MSFTNGP15.phx.gbl...
> I'm wondering if there are any other programmers/DBA's out there that have
> lots of databases that they need to routinely monitor its file growth over
> time. I'm looking for any VB code or scripts that accomplish this.
> We have about 500 SQL Server databases on one of our servers and they
> extend daily.
> I would like to capture their size and save the data so it can be graphed
> in Excel or something to show the growth rate of each database.
> If anyone has any sample code or idea how I can do some of this -- I would
> appreciate it greatly.
>
>|||...also sp_databases would probably do this if you don't want to split up
log and data files.
John
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:eR1GFfb7EHA.2804@.TK2MSFTNGP15.phx.gbl...
> Hi
> You may want to check out the code in sp_spaceused and adapt it to suit
> your purposes.
> John
> "DavidM" <spam@.spam.net> wrote in message
> news:uBE%231Bb7EHA.2804@.TK2MSFTNGP15.phx.gbl...
>> I'm wondering if there are any other programmers/DBA's out there that
>> have lots of databases that they need to routinely monitor its file
>> growth over time. I'm looking for any VB code or scripts that accomplish
>> this.
>> We have about 500 SQL Server databases on one of our servers and they
>> extend daily.
>> I would like to capture their size and save the data so it can be graphed
>> in Excel or something to show the growth rate of each database.
>> If anyone has any sample code or idea how I can do some of this -- I
>> would appreciate it greatly.
>>
>|||There are some code can be used on this web site:
http://www.sqlservercentral.com/scripts/contributions/31.asp
I tried it, seems very nice.
Good luck
"DavidM" <spam@.spam.net> wrote in message
news:uBE%231Bb7EHA.2804@.TK2MSFTNGP15.phx.gbl...
> I'm wondering if there are any other programmers/DBA's out there that have
> lots of databases that they need to routinely monitor its file growth over
> time. I'm looking for any VB code or scripts that accomplish this.
> We have about 500 SQL Server databases on one of our servers and they
extend
> daily.
> I would like to capture their size and save the data so it can be graphed
in
> Excel or something to show the growth rate of each database.
> If anyone has any sample code or idea how I can do some of this -- I would
> appreciate it greatly.
>
>|||If I run a query on the .sysfiles table, the size column shows 1704. Is
this in pages? How do I convert to bytes or megabytes?
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:eR1GFfb7EHA.2804@.TK2MSFTNGP15.phx.gbl...
> Hi
> You may want to check out the code in sp_spaceused and adapt it to suit
> your purposes.
> John
> "DavidM" <spam@.spam.net> wrote in message
> news:uBE%231Bb7EHA.2804@.TK2MSFTNGP15.phx.gbl...
>> I'm wondering if there are any other programmers/DBA's out there that
>> have lots of databases that they need to routinely monitor its file
>> growth over time. I'm looking for any VB code or scripts that accomplish
>> this.
>> We have about 500 SQL Server databases on one of our servers and they
>> extend daily.
>> I would like to capture their size and save the data so it can be graphed
>> in Excel or something to show the growth rate of each database.
>> If anyone has any sample code or idea how I can do some of this -- I
>> would appreciate it greatly.
>>
>|||> If I run a query on the .sysfiles table, the size column shows 1704. Is
> this in pages? How do I convert to bytes or megabytes?
SELECT
[Filename],
[SIZE IN KB] = size*8
FROM sysfiles|||Thanks for the reply. I was able to find
http://www.databasejournal.com/features/mssql/article.php/3339681 which
looks promising.
I got this to work but its a bit kludgy. Since I have a VB application that
we run daily, I'd like to incorporate the collection of stats within this
program.
Next question is, what is the best way to graph this data using Excel? Can
I have Excel read the database/table directory from SQL? If so, that is
what I want to do rather than create a .CSV file from SQL.
Opinions?
"Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:OG7fWJb7EHA.1408@.TK2MSFTNGP10.phx.gbl...
> There are multiple ways you could do this.
> One would be a scheduled job in SQL Server, which uses either the
> undocumented sp_MSForEachDB or a cursor, loops through the databases, and
> logs the result of sp_helpfile. This can be useful if you want to leave
> out
> irrelevant databases using the where clause for the cursor or an if
> conditional.
> Another way would be a windows scheduled task that calls a VBS script,
> using
> FileSystemObject to loop through all the MDF/NDF files and logs their size
> property. This can be useful if all of your relevant databases are in a
> specific location, separate from the system databases and/or other
> databases
> you are not interested in logging.
> If you can wait a day or two, I will whip something up that should be a
> bit
> more concrete than the above... in the meantime, you could take a crack at
> it, and post here if you have specific issues.
> Let's narrow the discussion groups down though, okay?
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>
>
> "DavidM" <spam@.spam.net> wrote in message
> news:uBE#1Bb7EHA.2804@.TK2MSFTNGP15.phx.gbl...
>> I'm wondering if there are any other programmers/DBA's out there that
>> have
>> lots of databases that they need to routinely monitor its file growth
>> over
>> time. I'm looking for any VB code or scripts that accomplish this.
>> We have about 500 SQL Server databases on one of our servers and they
> extend
>> daily.
>> I would like to capture their size and save the data so it can be graphed
> in
>> Excel or something to show the growth rate of each database.
>> If anyone has any sample code or idea how I can do some of this -- I
>> would
>> appreciate it greatly.
>>
>|||> Next question is, what is the best way to graph this data using Excel?
Have you considered using Reporting Services?|||or you might wish to setup a sql agent job to run at the end of each business
day to collect the information and popuate a base table
-- try the simple but useful approach below
/** the following can be quite useful **/
select instance_name,cntr_value 'Size in (Kb)' from
master..sysperfinfo(nolock)
where object_name like '%databases%'
and counter_name = 'Data File(s) size (Kb)'
and instance_name not in ('_total') -- can include total to get a server
based overview
"DavidM" wrote:
> I'm wondering if there are any other programmers/DBA's out there that have
> lots of databases that they need to routinely monitor its file growth over
> time. I'm looking for any VB code or scripts that accomplish this.
> We have about 500 SQL Server databases on one of our servers and they extend
> daily.
> I would like to capture their size and save the data so it can be graphed in
> Excel or something to show the growth rate of each database.
> If anyone has any sample code or idea how I can do some of this -- I would
> appreciate it greatly.
>
>|||Is that something I have to buy?
I'm on a zero budget and I need something quick to monitor all my databases.
"Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:OJ7n$Uc7EHA.2676@.TK2MSFTNGP12.phx.gbl...
>> Next question is, what is the best way to graph this data using Excel?
> Have you considered using Reporting Services?
>|||>> Have you considered using Reporting Services?
> Is that something I have to buy?
No. If memory servers, it comes with the license of SQL Server.|||"DavidM" <spam@.spam.net> wrote in message
news:OtfnEne7EHA.2516@.TK2MSFTNGP09.phx.gbl...
> Is that something I have to buy?
> I'm on a zero budget and I need something quick to monitor all my
databases.
Nope.
Go to www.microsoft.com and you'll find it there.
I've only started to play with it, but the SQL Reports you can download for
it are cool.
>
> "Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
> news:OJ7n$Uc7EHA.2676@.TK2MSFTNGP12.phx.gbl...
> >> Next question is, what is the best way to graph this data using Excel?
> >
> > Have you considered using Reporting Services?
> >
> >
>|||Can you give me exact URL. I'm not sure what product or component your
referring to and I cannot seem to find anything on MS website.
"Greg D. Moore (Strider)" <mooregr_deleteth1s@.greenms.com> wrote in message
news:CPHAd.79614$Uf.15857@.twister.nyroc.rr.com...
> "DavidM" <spam@.spam.net> wrote in message
> news:OtfnEne7EHA.2516@.TK2MSFTNGP09.phx.gbl...
>> Is that something I have to buy?
>> I'm on a zero budget and I need something quick to monitor all my
> databases.
> Nope.
> Go to www.microsoft.com and you'll find it there.
> I've only started to play with it, but the SQL Reports you can download
> for
> it are cool.
>
>>
>> "Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
>> news:OJ7n$Uc7EHA.2676@.TK2MSFTNGP12.phx.gbl...
>> >> Next question is, what is the best way to graph this data using Excel?
>> >
>> > Have you considered using Reporting Services?
>> >
>> >
>>
>|||> Can you give me exact URL. I'm not sure what product or component your
> referring to and I cannot seem to find anything on MS website.
Geez, did you try using the little "search" tool? It's on the top right of
the page, in case you ever need anything from microsoft.com again...
http://www.microsoft.com/sql/reporting/default.asp
--
http://www.aspfaq.com/
(Reverse address to reply.)

Capturing database size on a schedule and graphing?

I'm wondering if there are any other programmers/DBA's out there that have
lots of databases that they need to routinely monitor its file growth over
time. I'm looking for any VB code or scripts that accomplish this.
We have about 500 SQL Server databases on one of our servers and they extend
daily.
I would like to capture their size and save the data so it can be graphed in
Excel or something to show the growth rate of each database.
If anyone has any sample code or idea how I can do some of this -- I would
appreciate it greatly.
There are multiple ways you could do this.
One would be a scheduled job in SQL Server, which uses either the
undocumented sp_MSForEachDB or a cursor, loops through the databases, and
logs the result of sp_helpfile. This can be useful if you want to leave out
irrelevant databases using the where clause for the cursor or an if
conditional.
Another way would be a windows scheduled task that calls a VBS script, using
FileSystemObject to loop through all the MDF/NDF files and logs their size
property. This can be useful if all of your relevant databases are in a
specific location, separate from the system databases and/or other databases
you are not interested in logging.
If you can wait a day or two, I will whip something up that should be a bit
more concrete than the above... in the meantime, you could take a crack at
it, and post here if you have specific issues.
Let's narrow the discussion groups down though, okay?
http://www.aspfaq.com/
(Reverse address to reply.)
"DavidM" <spam@.spam.net> wrote in message
news:uBE#1Bb7EHA.2804@.TK2MSFTNGP15.phx.gbl...
> I'm wondering if there are any other programmers/DBA's out there that have
> lots of databases that they need to routinely monitor its file growth over
> time. I'm looking for any VB code or scripts that accomplish this.
> We have about 500 SQL Server databases on one of our servers and they
extend
> daily.
> I would like to capture their size and save the data so it can be graphed
in
> Excel or something to show the growth rate of each database.
> If anyone has any sample code or idea how I can do some of this -- I would
> appreciate it greatly.
>
>
|||Hi
You may want to check out the code in sp_spaceused and adapt it to suit your
purposes.
John
"DavidM" <spam@.spam.net> wrote in message
news:uBE%231Bb7EHA.2804@.TK2MSFTNGP15.phx.gbl...
> I'm wondering if there are any other programmers/DBA's out there that have
> lots of databases that they need to routinely monitor its file growth over
> time. I'm looking for any VB code or scripts that accomplish this.
> We have about 500 SQL Server databases on one of our servers and they
> extend daily.
> I would like to capture their size and save the data so it can be graphed
> in Excel or something to show the growth rate of each database.
> If anyone has any sample code or idea how I can do some of this -- I would
> appreciate it greatly.
>
>
|||...also sp_databases would probably do this if you don't want to split up
log and data files.
John
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:eR1GFfb7EHA.2804@.TK2MSFTNGP15.phx.gbl...
> Hi
> You may want to check out the code in sp_spaceused and adapt it to suit
> your purposes.
> John
> "DavidM" <spam@.spam.net> wrote in message
> news:uBE%231Bb7EHA.2804@.TK2MSFTNGP15.phx.gbl...
>
|||There are some code can be used on this web site:
http://www.sqlservercentral.com/scri...butions/31.asp
I tried it, seems very nice.
Good luck
"DavidM" <spam@.spam.net> wrote in message
news:uBE%231Bb7EHA.2804@.TK2MSFTNGP15.phx.gbl...
> I'm wondering if there are any other programmers/DBA's out there that have
> lots of databases that they need to routinely monitor its file growth over
> time. I'm looking for any VB code or scripts that accomplish this.
> We have about 500 SQL Server databases on one of our servers and they
extend
> daily.
> I would like to capture their size and save the data so it can be graphed
in
> Excel or something to show the growth rate of each database.
> If anyone has any sample code or idea how I can do some of this -- I would
> appreciate it greatly.
>
>
|||If I run a query on the .sysfiles table, the size column shows 1704. Is
this in pages? How do I convert to bytes or megabytes?
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:eR1GFfb7EHA.2804@.TK2MSFTNGP15.phx.gbl...
> Hi
> You may want to check out the code in sp_spaceused and adapt it to suit
> your purposes.
> John
> "DavidM" <spam@.spam.net> wrote in message
> news:uBE%231Bb7EHA.2804@.TK2MSFTNGP15.phx.gbl...
>
|||> If I run a query on the .sysfiles table, the size column shows 1704. Is
> this in pages? How do I convert to bytes or megabytes?
SELECT
[Filename],
[SIZE IN KB] = size*8
FROM sysfiles
|||Thanks for the reply. I was able to find
http://www.databasejournal.com/featu...le.php/3339681 which
looks promising.
I got this to work but its a bit kludgy. Since I have a VB application that
we run daily, I'd like to incorporate the collection of stats within this
program.
Next question is, what is the best way to graph this data using Excel? Can
I have Excel read the database/table directory from SQL? If so, that is
what I want to do rather than create a .CSV file from SQL.
Opinions?
"Aaron [SQL Server MVP]" <ten.xoc@.dnartreb.noraa> wrote in message
news:OG7fWJb7EHA.1408@.TK2MSFTNGP10.phx.gbl...
> There are multiple ways you could do this.
> One would be a scheduled job in SQL Server, which uses either the
> undocumented sp_MSForEachDB or a cursor, loops through the databases, and
> logs the result of sp_helpfile. This can be useful if you want to leave
> out
> irrelevant databases using the where clause for the cursor or an if
> conditional.
> Another way would be a windows scheduled task that calls a VBS script,
> using
> FileSystemObject to loop through all the MDF/NDF files and logs their size
> property. This can be useful if all of your relevant databases are in a
> specific location, separate from the system databases and/or other
> databases
> you are not interested in logging.
> If you can wait a day or two, I will whip something up that should be a
> bit
> more concrete than the above... in the meantime, you could take a crack at
> it, and post here if you have specific issues.
> Let's narrow the discussion groups down though, okay?
> --
> http://www.aspfaq.com/
> (Reverse address to reply.)
>
>
> "DavidM" <spam@.spam.net> wrote in message
> news:uBE#1Bb7EHA.2804@.TK2MSFTNGP15.phx.gbl...
> extend
> in
>
|||> Next question is, what is the best way to graph this data using Excel?
Have you considered using Reporting Services?
|||or you might wish to setup a sql agent job to run at the end of each business
day to collect the information and popuate a base table
-- try the simple but useful approach below
/** the following can be quite useful **/
select instance_name,cntr_value 'Size in (Kb)' from
master..sysperfinfo(nolock)
where object_name like '%databases%'
and counter_name = 'Data File(s) size (Kb)'
and instance_name not in ('_total') -- can include total to get a server
based overview
"DavidM" wrote:

> I'm wondering if there are any other programmers/DBA's out there that have
> lots of databases that they need to routinely monitor its file growth over
> time. I'm looking for any VB code or scripts that accomplish this.
> We have about 500 SQL Server databases on one of our servers and they extend
> daily.
> I would like to capture their size and save the data so it can be graphed in
> Excel or something to show the growth rate of each database.
> If anyone has any sample code or idea how I can do some of this -- I would
> appreciate it greatly.
>
>

Capturing a PDF file

I have a report that is being rendered to PDF using the UrlAccess method
from a C# WindowsForms application. Can someone indicate how I can capture
the file from the server to eliminate the step of opening IE and having to
click Open on the download dialog.
i.e. I want to give the user a seamless one-click route to viewing, and then
printing, the PDF.
I assume it can be done using the HttpRequest class but I'd appreciate a
leg-up...
brian smithhttp://servername/reportserver?/Sales/YearlySalesSummary&rs:Format=PDF&rs:Command=RenderSearch
for URL Access in Books on line... The Format parameter is documented
there..Have fun!
--
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Brian Smith" <bsmith@.nospam.leazesdotcom> wrote in message
news:OvA18QOZEHA.2260@.TK2MSFTNGP12.phx.gbl...
> I have a report that is being rendered to PDF using the UrlAccess method
> from a C# WindowsForms application. Can someone indicate how I can capture
> the file from the server to eliminate the step of opening IE and having to
> click Open on the download dialog.
> i.e. I want to give the user a seamless one-click route to viewing, and
then
> printing, the PDF.
> I assume it can be done using the HttpRequest class but I'd appreciate a
> leg-up...
> brian smith
>|||Err, that's exactly what I'm doing (is that a typo - I'm using
Command=Render - don't think there is a RenderSearch command).
My question concerns capturing the rendered byte stream - but I've found the
answer in the FindRenderSave sample application.
brian
"Wayne Snyder" <wayne.nospam.snyder@.mariner-usa.com> wrote in message
news:u5CWb$OZEHA.3128@.TK2MSFTNGP09.phx.gbl...
>
http://servername/reportserver?/Sales/YearlySalesSummary&rs:Format=PDF&rs:Command=RenderSearch
> for URL Access in Books on line... The Format parameter is documented
> there..Have fun!
> --
> Wayne Snyder, MCDBA, SQL Server MVP
> Mariner, Charlotte, NC
> www.mariner-usa.com
> (Please respond only to the newsgroups.)
> I support the Professional Association of SQL Server (PASS) and it's
> community of SQL Server professionals.
> www.sqlpass.org
> "Brian Smith" <bsmith@.nospam.leazesdotcom> wrote in message
> news:OvA18QOZEHA.2260@.TK2MSFTNGP12.phx.gbl...
> > I have a report that is being rendered to PDF using the UrlAccess method
> > from a C# WindowsForms application. Can someone indicate how I can
capture
> > the file from the server to eliminate the step of opening IE and having
to
> > click Open on the download dialog.
> > i.e. I want to give the user a seamless one-click route to viewing, and
> then
> > printing, the PDF.
> >
> > I assume it can be done using the HttpRequest class but I'd appreciate a
> > leg-up...
> >
> > brian smith
> >
> >
>

Capture Traces of all Transactions

How can I capture and trace transactions to a log file that will run all day?If this is a one time thing you could use Profiler and alter the default setting to log to a file.

Capture System.IO rows from incoming file and insert into table

Ok, I'm not quite sure how to approach this one. This is a VB.NET console app in which I want to capture each row and throw it into a table. The reason being, they want a report on what was processed...which I'll be able to do easily in Reporting Services 2005 once this crap is in a table where it should be.

1) What should I use to do this, dataset? I want to use stored procedures also, not inline SQL

Function here takes an incoming file, and splits it up into separate files. I want to insert each row that is succesfully split

Public Sub ProcessFiles(ByVal sIncomingfile As String, ByVal sOutputDirectory As String)

If sIncomingfile <> "" And sOutputDirectory <> "" Then

Dim f As New Security.Permissions.FileIOPermission(Security.Permissions.PermissionState.None)
f.AllLocalFiles = Security.Permissions.FileIOPermissionAccess.Read

Dim file As New IO.FileInfo(sIncomingfile)
Dim filefs As IO.FileStream = Nothing
If file.Exists Then
Try
filefs = New IO.FileStream(file.FullName, IO.FileMode.Open) 'Place: 1
Catch ex As Exception
SendEmail("Incoming .mnt or .naf Filename Invalid or not found", "Place: 1")
Application.Exit()
End Try
End If

Dim reader As New IO.StreamReader(filefs)
Dim counter As Integer = 0

Dim CurrentFS As IO.FileStream
Dim CurrentWriter As IO.StreamWriter
Dim extension As String = IO.Path.GetExtension(file.FullName)


If extension = ".mnt" Then
While Not reader.Peek < 0
Dim Line As String = reader.ReadLine
If IsNumeric(Line.Substring(0, 1)) Then
Dim Parts() As String = Line.Split(" "c) ' split row into parts
If Parts(0).Length = 8 Then ' if first part is 8 then know we hit another header so cut and then write to file
counter += 1
If Not CurrentWriter Is Nothing Then CurrentWriter.Flush() : CurrentWriter.Close()
CurrentFS = New IO.FileStream(IO.Path.Combine(IO.Path.GetDirectoryName(sOutputDirectory), Line.Substring(59, 4) & "[" & counter.ToString & "]" & Now.ToString("MM-dd-yyyy") & IO.Path.GetExtension(file.FullName)), IO.FileMode.Create)
CurrentWriter = New IO.StreamWriter(CurrentFS)
End If

If Not CurrentWriter Is Nothing Then
CurrentWriter.WriteLine(Line)
End If

End If
End While

If Not CurrentWriter Is Nothing Then CurrentWriter.Flush() : CurrentWriter.Close()

MoveFilesFTP(sOutputDirectory, "mnt")

ElseIf extension = ".naf" Then
While Not reader.Peek < 0
Dim Line As String = reader.ReadLine
If Not IsNumeric(Line.Substring(0, 1)) Then ' if first part is not a number, then we know it's a header so split the file
counter += 1
If Not CurrentWriter Is Nothing Then CurrentWriter.Flush() : CurrentWriter.Close()
CurrentFS = New IO.FileStream(IO.Path.Combine(IO.Path.GetDirectoryName(sOutputDirectory), Line.Substring(6, 4) & "[" & counter.ToString & "]" & Now.ToString("MM-dd-yyyy") & IO.Path.GetExtension(file.FullName)), IO.FileMode.Create)
CurrentWriter = New IO.StreamWriter(CurrentFS)
End If

If Not CurrentWriter Is Nothing Then
CurrentWriter.WriteLine(Line)
End If

End While

If Not CurrentWriter Is Nothing Then CurrentWriter.Flush() : CurrentWriter.Close()

MoveFilesFTP(sOutputDirectory, "naf")
End If
Else
'input file not valid
SendEmail("Incoming .mnt or .naf Filename Invalid", "Place: 1")
End If
End Sub

You don't need a console application to import the data into SQL Server if you are in SQL Server 2000 you need a DTS package and in SQL Server 2005 you need an Integration services package. The only important thing to note is SQL Server being a RDBMS(relational database management systems) sees a text file as having Null values so you import your data into a Temp table then do INSERT INTO your destination table. Try the link below for sample DTS and Integration services code. Hope this helps.

http://www.sqlis.com/

|||

Put this somewhere at the top:

Dim conn as new sqlconnection("Your connect string")
conn.open
Dim cmd1 as new sqlcommand("INSERT INTO ProcessedFiles(Filename) VALUES (@.Filename) SELECT SCOPE_@.IDENTITY()")

cmd1.parameters.add("@.Filename",sqldbtype.varchar)

dim cmd2 as new sqlcommand("INSERT INTO ProcessedLines(FileID,LineNum,LineData) VALUES (@.FileID,@.LineNum,@.LineData)",conn)

cmd2.parameters.add("@.FileID",sqldbtype.int32)

cmd2.parameters.add("@.LineNum",sqldbtype.int32)

cmd2.parameters.add("@.LineData",sqldbtype.varchar)

Then after you get the filename in your code:

cmd1.parameters("@.Filename").value={Your filename variable}

cmd2.parameters("@.FileID").value = cmd1.executescaler

Then after you read a line of data from the file:

cmd2.parameters.add("@.LineNum").value=counter

cmd2.parameters.add("@.LineData").value=line

cmd2.executenonquery

And at the end of your program:

conn.close

of course, this assumes you have a table named processedfiles that has a Filename column, as well as an identity field. I would put a ProcessedDate field in there too, that defaults to GetUTCDate(). And a table named ProcessedLines that has three columns (FileID,LineNum,LineData).

Is that what you were looking for?

Sunday, February 19, 2012

capture line of flat file [Error]

Hi,

I have a flat file with several rows of entire type in one of the rows a string comes and when it goes away to guard in the BD it falls, since I can know in that this row of the flat file the string?

I'd like to help but I am not sure I followed your question. Can you calrify?

Rafael Salas

|||

PastillaReturn wrote:

Hi,

I have a flat file with several rows of entire type in one of the rows a string comes and when it goes away to guard in the BD it falls, since I can know in that this row of the flat file the string?

Sorry, this is getting lost in translation. Do you mean that you require to know which row(s) of the flat file failed?

-Jamie

|||

yes

|||

This isn't currently possible. If you want to change that, go here, vote, and add a comment:

Row numbers added to pipeline
(https://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=131335)

-Jamie

Capture Error In DTS Package

I have a SQL Server Package that is dumping a text file into an Access
Database. However, due to update timing every now and then it errors
out due to a primary key violation. How do I capture that error
number in my next Active Script Task and determine whether or not I
want to continue (since if it's a duplicate I just want to skip it and
finish the DTS package). If it's a different error I want to log
it.
Thanks!Hi
If these are identity values you may want to check out
http://www.sqldts.com/293.aspx
if not try
http://www.sqldts.com/282.aspx
John
"Creative" wrote:

> I have a SQL Server Package that is dumping a text file into an Access
> Database. However, due to update timing every now and then it errors
> out due to a primary key violation. How do I capture that error
> number in my next Active Script Task and determine whether or not I
> want to continue (since if it's a duplicate I just want to skip it and
> finish the DTS package). If it's a different error I want to log
> it.
> Thanks!
>|||On Nov 27, 3:00 am, John Bell <jbellnewspo...@.hotmail.com> wrote:
> Hi
> If these are identity values you may want to check outhttp://www.sqldts.co
m/293.aspx
> if not tryhttp://www.sqldts.com/282.aspx
> John
>
> "Creative" wrote:
>
> - Show quoted text -
Thanks for the reply but it doesn't look like that answers my
question. I'm actually using a File Transformation from a text file
to an access database. I have a connection to the text file and a
connection to an access database with a transformation connecting the
two.|||Hi
There was no mention of the destination database being an access database,
in your original post. I suggest that you therefore load into a staging tabl
e
and either do an update if the PK exists or an insert if it doesn't.
John
"Creative" wrote:

> On Nov 27, 3:00 am, John Bell <jbellnewspo...@.hotmail.com> wrote:
> Thanks for the reply but it doesn't look like that answers my
> question. I'm actually using a File Transformation from a text file
> to an access database. I have a connection to the text file and a
> connection to an access database with a transformation connecting the
> two.
>|||I don't know the answer, but it's a good question, and I'm in a
similar situation in SSIS - except I want to test for a warning code!
Googling found this crufty answer:
http://www.quest-pipelines.com/newsletter-v4/0603_E.htm
There may be a better answer if you open up the multiphase data pump
business, but I have small experience with that.
Note there is also a DTS group, I'll copy this to.
Josh
On Mon, 26 Nov 2007 13:54:33 -0800 (PST), Creative <GraberJ@.gmail.com>
wrote:

>I have a SQL Server Package that is dumping a text file into an Access
>Database. However, due to update timing every now and then it errors
>out due to a primary key violation. How do I capture that error
>number in my next Active Script Task and determine whether or not I
>want to continue (since if it's a duplicate I just want to skip it and
>finish the DTS package). If it's a different error I want to log
>it.
>Thanks!|||Hi Josh
I pointed the OP to the tutorial on Multiphase datapump on SQL DTS. In SSIS
you have a standarderrorvariable which may be of some use to you, and there
is the configure error output dialog. you may want to check out Professional
SQL Server 2005 Integration Services by Brian Knight et al ISBN 0764584359 o
r
the short videos on http://www.jumpstarttv.com such as
http://www.jumpstarttv.com/Media.aspx?vid=34 where Brian shows how an
application similar to the examples in the book work.
John
"JXStern" wrote:

> I don't know the answer, but it's a good question, and I'm in a
> similar situation in SSIS - except I want to test for a warning code!
> Googling found this crufty answer:
> http://www.quest-pipelines.com/newsletter-v4/0603_E.htm
> There may be a better answer if you open up the multiphase data pump
> business, but I have small experience with that.
> Note there is also a DTS group, I'll copy this to.
> Josh
>
> On Mon, 26 Nov 2007 13:54:33 -0800 (PST), Creative <GraberJ@.gmail.com>
> wrote:
>
>|||John,
Thanks for several good hints, I'll be following them all. Configure error
output dialog?!?! Oh, in a data flow. Righto.
I keep waiting for some other, newer SSIS books to come out.
I've got the basics grinding along now, anyway.
Thanks again.
Josh
"John Bell" wrote:
[vbcol=seagreen]
> Hi Josh
> I pointed the OP to the tutorial on Multiphase datapump on SQL DTS. In SSI
S
> you have a standarderrorvariable which may be of some use to you, and ther
e
> is the configure error output dialog. you may want to check out Profession
al
> SQL Server 2005 Integration Services by Brian Knight et al ISBN 0764584359
or
> the short videos on http://www.jumpstarttv.com such as
> http://www.jumpstarttv.com/Media.aspx?vid=34 where Brian shows how an
> application similar to the examples in the book work.
> John
> "JXStern" wrote:
>

Capture Error In DTS Package

I have a SQL Server Package that is dumping a text file into an Access
Database. However, due to update timing every now and then it errors
out due to a primary key violation. How do I capture that error
number in my next Active Script Task and determine whether or not I
want to continue (since if it's a duplicate I just want to skip it and
finish the DTS package). If it's a different error I want to log
it.
Thanks!Hi
If these are identity values you may want to check out
http://www.sqldts.com/293.aspx
if not try
http://www.sqldts.com/282.aspx
John
"Creative" wrote:
> I have a SQL Server Package that is dumping a text file into an Access
> Database. However, due to update timing every now and then it errors
> out due to a primary key violation. How do I capture that error
> number in my next Active Script Task and determine whether or not I
> want to continue (since if it's a duplicate I just want to skip it and
> finish the DTS package). If it's a different error I want to log
> it.
> Thanks!
>|||On Nov 27, 3:00 am, John Bell <jbellnewspo...@.hotmail.com> wrote:
> Hi
> If these are identity values you may want to check outhttp://www.sqldts.com/293.aspx
> if not tryhttp://www.sqldts.com/282.aspx
> John
>
> "Creative" wrote:
> > I have a SQL Server Package that is dumping a text file into an Access
> > Database. However, due to update timing every now and then it errors
> > out due to a primary key violation. How do I capture that error
> > number in my next Active Script Task and determine whether or not I
> > want to continue (since if it's a duplicate I just want to skip it and
> > finish the DTS package). If it's a different error I want to log
> > it.
> > Thanks!- Hide quoted text -
> - Show quoted text -
Thanks for the reply but it doesn't look like that answers my
question. I'm actually using a File Transformation from a text file
to an access database. I have a connection to the text file and a
connection to an access database with a transformation connecting the
two.|||Hi
There was no mention of the destination database being an access database,
in your original post. I suggest that you therefore load into a staging table
and either do an update if the PK exists or an insert if it doesn't.
John
"Creative" wrote:
> On Nov 27, 3:00 am, John Bell <jbellnewspo...@.hotmail.com> wrote:
> > Hi
> >
> > If these are identity values you may want to check outhttp://www.sqldts.com/293.aspx
> > if not tryhttp://www.sqldts.com/282.aspx
> >
> > John
> >
> >
> >
> > "Creative" wrote:
> > > I have a SQL Server Package that is dumping a text file into an Access
> > > Database. However, due to update timing every now and then it errors
> > > out due to a primary key violation. How do I capture that error
> > > number in my next Active Script Task and determine whether or not I
> > > want to continue (since if it's a duplicate I just want to skip it and
> > > finish the DTS package). If it's a different error I want to log
> > > it.
> >
> > > Thanks!- Hide quoted text -
> >
> > - Show quoted text -
> Thanks for the reply but it doesn't look like that answers my
> question. I'm actually using a File Transformation from a text file
> to an access database. I have a connection to the text file and a
> connection to an access database with a transformation connecting the
> two.
>|||I don't know the answer, but it's a good question, and I'm in a
similar situation in SSIS - except I want to test for a warning code!
Googling found this crufty answer:
http://www.quest-pipelines.com/newsletter-v4/0603_E.htm
There may be a better answer if you open up the multiphase data pump
business, but I have small experience with that.
Note there is also a DTS group, I'll copy this to.
Josh
On Mon, 26 Nov 2007 13:54:33 -0800 (PST), Creative <GraberJ@.gmail.com>
wrote:
>I have a SQL Server Package that is dumping a text file into an Access
>Database. However, due to update timing every now and then it errors
>out due to a primary key violation. How do I capture that error
>number in my next Active Script Task and determine whether or not I
>want to continue (since if it's a duplicate I just want to skip it and
>finish the DTS package). If it's a different error I want to log
>it.
>Thanks!|||Hi Josh
I pointed the OP to the tutorial on Multiphase datapump on SQL DTS. In SSIS
you have a standarderrorvariable which may be of some use to you, and there
is the configure error output dialog. you may want to check out Professional
SQL Server 2005 Integration Services by Brian Knight et al ISBN 0764584359 or
the short videos on http://www.jumpstarttv.com such as
http://www.jumpstarttv.com/Media.aspx?vid=34 where Brian shows how an
application similar to the examples in the book work.
John
"JXStern" wrote:
> I don't know the answer, but it's a good question, and I'm in a
> similar situation in SSIS - except I want to test for a warning code!
> Googling found this crufty answer:
> http://www.quest-pipelines.com/newsletter-v4/0603_E.htm
> There may be a better answer if you open up the multiphase data pump
> business, but I have small experience with that.
> Note there is also a DTS group, I'll copy this to.
> Josh
>
> On Mon, 26 Nov 2007 13:54:33 -0800 (PST), Creative <GraberJ@.gmail.com>
> wrote:
> >I have a SQL Server Package that is dumping a text file into an Access
> >Database. However, due to update timing every now and then it errors
> >out due to a primary key violation. How do I capture that error
> >number in my next Active Script Task and determine whether or not I
> >want to continue (since if it's a duplicate I just want to skip it and
> >finish the DTS package). If it's a different error I want to log
> >it.
> >
> >Thanks!
>|||John,
Thanks for several good hints, I'll be following them all. Configure error
output dialog?!?! Oh, in a data flow. Righto.
I keep waiting for some other, newer SSIS books to come out.
I've got the basics grinding along now, anyway.
Thanks again.
Josh
"John Bell" wrote:
> Hi Josh
> I pointed the OP to the tutorial on Multiphase datapump on SQL DTS. In SSIS
> you have a standarderrorvariable which may be of some use to you, and there
> is the configure error output dialog. you may want to check out Professional
> SQL Server 2005 Integration Services by Brian Knight et al ISBN 0764584359 or
> the short videos on http://www.jumpstarttv.com such as
> http://www.jumpstarttv.com/Media.aspx?vid=34 where Brian shows how an
> application similar to the examples in the book work.
> John
> "JXStern" wrote:
> > I don't know the answer, but it's a good question, and I'm in a
> > similar situation in SSIS - except I want to test for a warning code!
> >
> > Googling found this crufty answer:
> > http://www.quest-pipelines.com/newsletter-v4/0603_E.htm
> >
> > There may be a better answer if you open up the multiphase data pump
> > business, but I have small experience with that.
> >
> > Note there is also a DTS group, I'll copy this to.
> >
> > Josh
> >
> >
> > On Mon, 26 Nov 2007 13:54:33 -0800 (PST), Creative <GraberJ@.gmail.com>
> > wrote:
> >
> > >I have a SQL Server Package that is dumping a text file into an Access
> > >Database. However, due to update timing every now and then it errors
> > >out due to a primary key violation. How do I capture that error
> > >number in my next Active Script Task and determine whether or not I
> > >want to continue (since if it's a duplicate I just want to skip it and
> > >finish the DTS package). If it's a different error I want to log
> > >it.
> > >
> > >Thanks!
> >
> >

Capture Error In DTS Package

I have a SQL Server Package that is dumping a text file into an Access
Database. However, due to update timing every now and then it errors
out due to a primary key violation. How do I capture that error
number in my next Active Script Task and determine whether or not I
want to continue (since if it's a duplicate I just want to skip it and
finish the DTS package). If it's a different error I want to log
it.
Thanks!
Hi
If these are identity values you may want to check out
http://www.sqldts.com/293.aspx
if not try
http://www.sqldts.com/282.aspx
John
"Creative" wrote:

> I have a SQL Server Package that is dumping a text file into an Access
> Database. However, due to update timing every now and then it errors
> out due to a primary key violation. How do I capture that error
> number in my next Active Script Task and determine whether or not I
> want to continue (since if it's a duplicate I just want to skip it and
> finish the DTS package). If it's a different error I want to log
> it.
> Thanks!
>
|||On Nov 27, 3:00 am, John Bell <jbellnewspo...@.hotmail.com> wrote:
> Hi
> If these are identity values you may want to check outhttp://www.sqldts.com/293.aspx
> if not tryhttp://www.sqldts.com/282.aspx
> John
>
> "Creative" wrote:
>
> - Show quoted text -
Thanks for the reply but it doesn't look like that answers my
question. I'm actually using a File Transformation from a text file
to an access database. I have a connection to the text file and a
connection to an access database with a transformation connecting the
two.
|||Hi
There was no mention of the destination database being an access database,
in your original post. I suggest that you therefore load into a staging table
and either do an update if the PK exists or an insert if it doesn't.
John
"Creative" wrote:

> On Nov 27, 3:00 am, John Bell <jbellnewspo...@.hotmail.com> wrote:
> Thanks for the reply but it doesn't look like that answers my
> question. I'm actually using a File Transformation from a text file
> to an access database. I have a connection to the text file and a
> connection to an access database with a transformation connecting the
> two.
>
|||I don't know the answer, but it's a good question, and I'm in a
similar situation in SSIS - except I want to test for a warning code!
Googling found this crufty answer:
http://www.quest-pipelines.com/newsletter-v4/0603_E.htm
There may be a better answer if you open up the multiphase data pump
business, but I have small experience with that.
Note there is also a DTS group, I'll copy this to.
Josh
On Mon, 26 Nov 2007 13:54:33 -0800 (PST), Creative <GraberJ@.gmail.com>
wrote:

>I have a SQL Server Package that is dumping a text file into an Access
>Database. However, due to update timing every now and then it errors
>out due to a primary key violation. How do I capture that error
>number in my next Active Script Task and determine whether or not I
>want to continue (since if it's a duplicate I just want to skip it and
>finish the DTS package). If it's a different error I want to log
>it.
>Thanks!
|||Hi Josh
I pointed the OP to the tutorial on Multiphase datapump on SQL DTS. In SSIS
you have a standarderrorvariable which may be of some use to you, and there
is the configure error output dialog. you may want to check out Professional
SQL Server 2005 Integration Services by Brian Knight et al ISBN 0764584359 or
the short videos on http://www.jumpstarttv.com such as
http://www.jumpstarttv.com/Media.aspx?vid=34 where Brian shows how an
application similar to the examples in the book work.
John
"JXStern" wrote:

> I don't know the answer, but it's a good question, and I'm in a
> similar situation in SSIS - except I want to test for a warning code!
> Googling found this crufty answer:
> http://www.quest-pipelines.com/newsletter-v4/0603_E.htm
> There may be a better answer if you open up the multiphase data pump
> business, but I have small experience with that.
> Note there is also a DTS group, I'll copy this to.
> Josh
>
> On Mon, 26 Nov 2007 13:54:33 -0800 (PST), Creative <GraberJ@.gmail.com>
> wrote:
>
>
|||John,
Thanks for several good hints, I'll be following them all. Configure error
output dialog?!?! Oh, in a data flow. Righto.
I keep waiting for some other, newer SSIS books to come out.
I've got the basics grinding along now, anyway.
Thanks again.
Josh
"John Bell" wrote:
[vbcol=seagreen]
> Hi Josh
> I pointed the OP to the tutorial on Multiphase datapump on SQL DTS. In SSIS
> you have a standarderrorvariable which may be of some use to you, and there
> is the configure error output dialog. you may want to check out Professional
> SQL Server 2005 Integration Services by Brian Knight et al ISBN 0764584359 or
> the short videos on http://www.jumpstarttv.com such as
> http://www.jumpstarttv.com/Media.aspx?vid=34 where Brian shows how an
> application similar to the examples in the book work.
> John
> "JXStern" wrote:

Capture date and timestamp of a file?

Hi,

I am pulling files from the FTP site using the FTP task. I want to also capture the date and timestamp of each of these files so that I can insert the values into a database and track when are these files get created normally on the FTP server.

Any ideas?

Thanks in advance for your help.

$wapnil

Doesn't the transfer of files from the FTP server preserve the date and time? You could inspect that with a custom script.|||

No the transfer of files do not preserve the date and time. When i download the files all the files show the same date and timestamp.

Can the FTP task be configured to preserve the date and time?

Thanks!

$wapnil

|||

spattewar wrote:

No the transfer of files do not preserve the date and time. When i download the files all the files show the same date and timestamp.

Can the FTP task be configured to preserve the date and time?

Thanks!

$wapnil

Well.... You can write a custom script to perhaps issue an 'ls' command inside the FTP session. Remember, FTP isn't designed for file interrogation, it's designed to transport files.|||

Thanks.

I am using a ForEach loop container which iterates through a list of file names to be downloaded. In this container I have an FTP task that uses an FTP connection manger to connect and download the file name passed to it by the container. If the FTP is successful then I update the database using an Execute SQL task to tell that the file has been downloaded.

Where should I keep the custom script so that it runs inside the FTP session? Also can I use the File System task in some way? I am pretty new to his and hence may be asking very rudimentary questions..please be patient.

Thanks agains for your time.

$wapnil

|||The script would be your FTP session. It would replace your FTP task.|||

I will try this out and will let you know in case there are any problems.

Thanks.

$wapnil

Tuesday, February 14, 2012

can't use the index tuning wizard wioth a function??

Hi,
I receive this error when I try to execute the index tuning wizard:
"There are no events in the workload. Either the trace
file contained no SQL batch or RPC events or the SQL
script contained no SQL queries."
I have tried from the query analyzer and from a workload trace file, in the
2 cases I receive the error.
My query contain a join to a custom function which return a simple list.
if I remove the function, then the index tuning works fine.
my query:
select * from table1 inner join dbo.MyFunction(@.Param) A on table1.ID = A.ID
what can I do?
thanks.
Jerome.Jéjé wrote:
> Hi,
> I receive this error when I try to execute the index tuning wizard:
> "There are no events in the workload. Either the trace
> file contained no SQL batch or RPC events or the SQL
> script contained no SQL queries."
> I have tried from the query analyzer and from a workload trace file,
> in the 2 cases I receive the error.
> My query contain a join to a custom function which return a simple
> list. if I remove the function, then the index tuning works fine.
> my query:
> select * from table1 inner join dbo.MyFunction(@.Param) A on
> table1.ID = A.ID
> what can I do?
> thanks.
> Jerome.
You probably chose the wrong template for recording of events in profiler.
There is a template SQLProfilerTuning. It should work with that one.
Kind regards
robert|||I'm using standard templates which works fine with any query those with my
function.
but why I can't optimize from query analyzer?
"Robert Klemme" <bob.news@.gmx.net> wrote in message
news:e$XXF4wcFHA.2760@.tk2msftngp13.phx.gbl...
> Jéjé wrote:
>> Hi,
>> I receive this error when I try to execute the index tuning wizard:
>> "There are no events in the workload. Either the trace
>> file contained no SQL batch or RPC events or the SQL
>> script contained no SQL queries."
>> I have tried from the query analyzer and from a workload trace file,
>> in the 2 cases I receive the error.
>> My query contain a join to a custom function which return a simple
>> list. if I remove the function, then the index tuning works fine.
>> my query:
>> select * from table1 inner join dbo.MyFunction(@.Param) A on
>> table1.ID = A.ID
>> what can I do?
>> thanks.
>> Jerome.
> You probably chose the wrong template for recording of events in profiler.
> There is a template SQLProfilerTuning. It should work with that one.
> Kind regards
> robert
>