Wednesday, March 28, 2012
Newbie Question - Table only Backup
Thanks !!Put the table on a different filegroup, since you can back up filegroups
separately. You can't back up tables separately.
--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
"Joe Mizrahi" <mizrahij@.finance.nyc.gov> wrote in message
news:00470D0D-6DC6-4A59-AEF9-80FAE5EA26A2@.microsoft.com...
> I may be missing something... but I simply want to backup a single table
from my DB inorder to export it to another server (via FTP)... is there a
way to do this specifically in MS SQL 7 ' I want to save the backup on my
desktop, for instance... and not into another DB on the server... am I clear
or missing something...
> Thanks !!|||Note that such a backup is possibly unusable for Joe's scenario. When
restoring an FG backup you have to do that into the same database from where
you took the backup and also apply all log backups taken since, up to
current point in time.
Joe,
another option is to export he data in the table, using such tools as BCP,
DTS etc.
--
Tibor Karaszi, SQL Server MVP
Archive at:
http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
"Aaron Bertrand - MVP" <aaron@.TRASHaspfaq.com> wrote in message
news:eIhT5OpvDHA.2408@.tk2msftngp13.phx.gbl...
> Put the table on a different filegroup, since you can back up filegroups
> separately. You can't back up tables separately.
> --
> Aaron Bertrand
> SQL Server MVP
> http://www.aspfaq.com/
>
>
> "Joe Mizrahi" <mizrahij@.finance.nyc.gov> wrote in message
> news:00470D0D-6DC6-4A59-AEF9-80FAE5EA26A2@.microsoft.com...
> > I may be missing something... but I simply want to backup a single table
> from my DB inorder to export it to another server (via FTP)... is there a
> way to do this specifically in MS SQL 7 ' I want to save the backup on my
> desktop, for instance... and not into another DB on the server... am I
clear
> or missing something...
> > Thanks !!
>|||Ah, that's a good point. Yes, you could DTS the table to another database,
and backup from there. Or keep the table in its own separate database
permanently, I suppose.
--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/
"Tibor Karaszi" <tibor.please_reply_to_public_forum.karaszi@.cornerstone.se>
wrote in message news:eCdyUSpvDHA.1512@.TK2MSFTNGP10.phx.gbl...
> Note that such a backup is possibly unusable for Joe's scenario. When
> restoring an FG backup you have to do that into the same database from
where
> you took the backup and also apply all log backups taken since, up to
> current point in time.
> Joe,
> another option is to export he data in the table, using such tools as BCP,
> DTS etc.
> --
> Tibor Karaszi, SQL Server MVP
> Archive at:
>
http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver
>
> "Aaron Bertrand - MVP" <aaron@.TRASHaspfaq.com> wrote in message
> news:eIhT5OpvDHA.2408@.tk2msftngp13.phx.gbl...
> > Put the table on a different filegroup, since you can back up filegroups
> > separately. You can't back up tables separately.
> >
> > --
> > Aaron Bertrand
> > SQL Server MVP
> > http://www.aspfaq.com/
> >
> >
> >
> >
> > "Joe Mizrahi" <mizrahij@.finance.nyc.gov> wrote in message
> > news:00470D0D-6DC6-4A59-AEF9-80FAE5EA26A2@.microsoft.com...
> > > I may be missing something... but I simply want to backup a single
table
> > from my DB inorder to export it to another server (via FTP)... is there
a
> > way to do this specifically in MS SQL 7 ' I want to save the backup on
my
> > desktop, for instance... and not into another DB on the server... am I
> clear
> > or missing something...
> > > Thanks !!
> >
> >
>
Friday, March 9, 2012
Newbie Basic Question - DISTINCT & PKs
I'm in the process of trying to teach myself T-SQL out of a WROX book, and am having a problem wrapping my head around this example, I understand the concept of Primary Keys through using MS Access, but haven't used TSQL extensively (or at all for that matter...)
Using the classic "Northwind" database, using this query:
SELECT COUNT(OrderID)
FROM [Order Details]
This returns 2155, which is the total number of rows with an OrderID, the primary key. Now, as I understood it, a PK has to be unique, but yet this query on the same DB:
SELECT COUNT(DISTINCT OrderID)
FROM [Order Details]
returns 830 rows. If the PK (OrderID) is unqiue, how is the DISTINCT function returning fewer rows? Wouldn't that imply there are duplicate PKs?
I'm sure there's a simple answer to this, but I just can't seem to get my head around it... Thank you so much for taking the time to explain this to a rookie!Because orderId isn't the primary key of [order details]. The PK of that table is OrderId, ProductId. Check sp_help '[Order Details] ' for the details. OrderId is a Foreign Key reference to Orders, where the PK is orderId.|||
Aaaah.... I see, I think I mis-interpreted the information I was getting from Management Studio. Thank you so much for taking the time to correct a silly mistake!