Showing posts with label process. Show all posts
Showing posts with label process. Show all posts

Wednesday, March 28, 2012

Newbie Question - Please be gentle!

Can I run a script as an automated process?
i.e. I have a simple script that deletes the content of a table so I can
import fresh data, I know how to set up the DTS to import the data
automatically, but I have to run the script every day manually before the DTS
runs & I want the delete script to run at a predefined time rather than
having to remember to do it. Does that make sense?
Tia
JonathanSure. It's hard to give precise directions without know what you're scripts
look like, but... if you already have a DTS job you can easily create a
step in that package (that's what the DTS container is called) that will cun
a TSQL script. Then you can easily schedule that from SQLAgent. You can
right click on the job name from DTS and select 'schedule job' which will
walk you throught the process of setting up the DTS package to run from SQL
agent.
Hope that helps,
--
Brian Moran
Principal Mentor
Solid Quality Learning
SQL Server MVP
http://www.solidqualitylearning.com
"Jonathan" <Jonathan@.discussions.microsoft.com> wrote in message
news:F7E842B8-BFD6-4922-8ED2-4AD0BCE55CA6@.microsoft.com...
> Can I run a script as an automated process?
> i.e. I have a simple script that deletes the content of a table so I can
> import fresh data, I know how to set up the DTS to import the data
> automatically, but I have to run the script every day manually before the
DTS
> runs & I want the delete script to run at a predefined time rather than
> having to remember to do it. Does that make sense?
> Tia
> Jonathan

Monday, March 12, 2012

Newbie Help!

I work for a company who have just lost the IT Manager, and we are in the
process of appointing another, I am a amature person (normally in sales,
don't hate me). However, we are using Sharepoint POrtal server with a SQL
2000 server for the databases.
There is the companyC1_SITE database which is now showing as suspect after a
server restart, and I notice the LDF is showing 0kb size.
The msdb.mdf is also showing as suspect.
The error log says that the SITE database was not detached cleanly.
I have a backup from the beginning of October, but nothing after that seems
to be valid. So I now must rely on whether or not it will be possible to
recover the corrupt site MDF?
The MDF's are on a RAID array with 270GB free space so the databases did not
become suspect due to space running out.
Any pointers would be very much appreciated.
P.Your best bet if you want it fixed ASAP and with the least risk of data loss
is to contact MS PSS so they can work directly with you to see what can be
done. Is your data worth about $225.00? I suspect it is and that will be a
small price to pay to get it fixed properly.
http://support.microsoft.com/default.aspx?scid=fh;EN-US;sql SQL Support
http://www.mssqlserver.com/faq/general-pss.asp MS PSS
--
Andrew J. Kelly SQL MVP
"Paul Davies" <bob@.notachance.com> wrote in message
news:_9Kud.6383$Cp4.2422@.fe1.news.blueyonder.co.uk...
>I work for a company who have just lost the IT Manager, and we are in the
>process of appointing another, I am a amature person (normally in sales,
>don't hate me). However, we are using Sharepoint POrtal server with a SQL
>2000 server for the databases.
> There is the companyC1_SITE database which is now showing as suspect after
> a server restart, and I notice the LDF is showing 0kb size.
> The msdb.mdf is also showing as suspect.
> The error log says that the SITE database was not detached cleanly.
> I have a backup from the beginning of October, but nothing after that
> seems to be valid. So I now must rely on whether or not it will be
> possible to recover the corrupt site MDF?
> The MDF's are on a RAID array with 270GB free space so the databases did
> not become suspect due to space running out.
> Any pointers would be very much appreciated.
> P.
>|||I agree with Andrew. Call the experts. They can walk you throught the
steps most likely to get your data back. Right after that phone call, find
yourself a temporary IT guy from a reputable consulting company. You will
probably have to pay extra for the emergency coverage, but if your business
depends on your systems, you really don't have a choice.
--
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
"Andrew J. Kelly" <sqlmvpnooospam@.shadhawk.com> wrote in message
news:eTcXXn%233EHA.2592@.TK2MSFTNGP09.phx.gbl...
> Your best bet if you want it fixed ASAP and with the least risk of data
loss
> is to contact MS PSS so they can work directly with you to see what can be
> done. Is your data worth about $225.00? I suspect it is and that will be
a
> small price to pay to get it fixed properly.
>
> http://support.microsoft.com/default.aspx?scid=fh;EN-US;sql SQL Support
> http://www.mssqlserver.com/faq/general-pss.asp MS PSS
> --
> Andrew J. Kelly SQL MVP
>
> "Paul Davies" <bob@.notachance.com> wrote in message
> news:_9Kud.6383$Cp4.2422@.fe1.news.blueyonder.co.uk...
> >I work for a company who have just lost the IT Manager, and we are in the
> >process of appointing another, I am a amature person (normally in sales,
> >don't hate me). However, we are using Sharepoint POrtal server with a SQL
> >2000 server for the databases.
> >
> > There is the companyC1_SITE database which is now showing as suspect
after
> > a server restart, and I notice the LDF is showing 0kb size.
> >
> > The msdb.mdf is also showing as suspect.
> >
> > The error log says that the SITE database was not detached cleanly.
> >
> > I have a backup from the beginning of October, but nothing after that
> > seems to be valid. So I now must rely on whether or not it will be
> > possible to recover the corrupt site MDF?
> >
> > The MDF's are on a RAID array with 270GB free space so the databases did
> > not become suspect due to space running out.
> >
> > Any pointers would be very much appreciated.
> >
> > P.
> >
>

Friday, March 9, 2012

Newbie Database Diagraming Error Problem

I am in the process of taking my first stab at a MS SQL Server based DB.
The original DB was in MS Access and had a front end DB with the GUI and a
back end with the data. The data has been successfully transferred to the
SQL Server. Now I am in the process of re-building the relationships and am
getting a number of errors of the form:
'tblRoadTrip (MyDomain\TheUser)' table
- Unable to create relationship 'FK_tblRoadTrip_tblPrimary'.
ODBC error: [Microsoft][ODBC SQL Server Driver][SQL Server]ALTER TABLE
statement conflicted with COLUMN FOREIGN KEY constraint
'FK_tblRoadTrip_tblPrimary'. The conflict occurred in database
'MyFirstSQL_DB', table 'tblPrimary', column 'LinkID'.
when using the diagramming tool. The relationship between tblPrimary and
tblRoadTrip is one-to-many and the linking filed is LinkID. In tblPrimary,
LinkID is set as the primary key.
Any hints on where I can go to get information on how to solve this problem
will be greatly appreciated!
Thanks!
Don
Okay, I think I found the problem, we sort of ......
The table tblPrimary is empty! I went back to the Upsizing Wizard Report,
and low and behold the following message "Table was skipped, or export
failed". Will very authoritative, lacking in any information to diagnose
why the table was skipped or the export failed. I tried re-exporting the
table all by itself, and the report for that says "skipping table
'tblPrimary'".
What causes a file to be skipped during the upsizing wizard process?
Don
"Don" <someone@.somewhere.net> wrote in message
news:e40TnYRwFHA.2656@.TK2MSFTNGP09.phx.gbl...
> I am in the process of taking my first stab at a MS SQL Server based DB.
> The original DB was in MS Access and had a front end DB with the GUI and a
> back end with the data. The data has been successfully transferred to the
> SQL Server. Now I am in the process of re-building the relationships and
> am getting a number of errors of the form:
> 'tblRoadTrip (MyDomain\TheUser)' table
> - Unable to create relationship 'FK_tblRoadTrip_tblPrimary'.
> ODBC error: [Microsoft][ODBC SQL Server Driver][SQL Server]ALTER TABLE
> statement conflicted with COLUMN FOREIGN KEY constraint
> 'FK_tblRoadTrip_tblPrimary'. The conflict occurred in database
> 'MyFirstSQL_DB', table 'tblPrimary', column 'LinkID'.
> when using the diagramming tool. The relationship between tblPrimary and
> tblRoadTrip is one-to-many and the linking filed is LinkID. In
> tblPrimary, LinkID is set as the primary key.
> Any hints on where I can go to get information on how to solve this
> problem will be greatly appreciated!
> Thanks!
> Don
>
>
|||Figuring that bad data might be a cause, I finally found the problem with
some invalid dates. While the MS Access table used date fields, looks like
it is much more forgiving in terms of mis-entered dates.
Don
"Don" <someone@.somewhere.net> wrote in message
news:OYLs7FSwFHA.3300@.TK2MSFTNGP09.phx.gbl...
> Okay, I think I found the problem, we sort of ......
> The table tblPrimary is empty! I went back to the Upsizing Wizard Report,
> and low and behold the following message "Table was skipped, or export
> failed". Will very authoritative, lacking in any information to diagnose
> why the table was skipped or the export failed. I tried re-exporting the
> table all by itself, and the report for that says "skipping table
> 'tblPrimary'".
> What causes a file to be skipped during the upsizing wizard process?
> Don
>
>
> "Don" <someone@.somewhere.net> wrote in message
> news:e40TnYRwFHA.2656@.TK2MSFTNGP09.phx.gbl...
>

Newbie Database Diagraming Error Problem

I am in the process of taking my first stab at a MS SQL Server based DB.
The original DB was in MS Access and had a front end DB with the GUI and a
back end with the data. The data has been successfully transferred to the
SQL Server. Now I am in the process of re-building the relationships and am
getting a number of errors of the form:
'tblRoadTrip (MyDomain\TheUser)' table
- Unable to create relationship 'FK_tblRoadTrip_tblPrimary'.
ODBC error: [Microsoft][ODBC SQL Server Driver][SQL Server]ALTER
TABLE
statement conflicted with COLUMN FOREIGN KEY constraint
'FK_tblRoadTrip_tblPrimary'. The conflict occurred in database
'MyFirstSQL_DB', table 'tblPrimary', column 'LinkID'.
when using the diagramming tool. The relationship between tblPrimary and
tblRoadTrip is one-to-many and the linking filed is LinkID. In tblPrimary,
LinkID is set as the primary key.
Any hints on where I can go to get information on how to solve this problem
will be greatly appreciated!
Thanks!
DonOkay, I think I found the problem, we sort of ......
The table tblPrimary is empty! I went back to the Upsizing Wizard Report,
and low and behold the following message "Table was skipped, or export
failed". Will very authoritative, lacking in any information to diagnose
why the table was skipped or the export failed. I tried re-exporting the
table all by itself, and the report for that says "skipping table
'tblPrimary'".
What causes a file to be skipped during the upsizing wizard process?
Don
"Don" <someone@.somewhere.net> wrote in message
news:e40TnYRwFHA.2656@.TK2MSFTNGP09.phx.gbl...
> I am in the process of taking my first stab at a MS SQL Server based DB.
> The original DB was in MS Access and had a front end DB with the GUI and a
> back end with the data. The data has been successfully transferred to the
> SQL Server. Now I am in the process of re-building the relationships and
> am getting a number of errors of the form:
> 'tblRoadTrip (MyDomain\TheUser)' table
> - Unable to create relationship 'FK_tblRoadTrip_tblPrimary'.
> ODBC error: [Microsoft][ODBC SQL Server Driver][SQL Server]ALT
ER TABLE
> statement conflicted with COLUMN FOREIGN KEY constraint
> 'FK_tblRoadTrip_tblPrimary'. The conflict occurred in database
> 'MyFirstSQL_DB', table 'tblPrimary', column 'LinkID'.
> when using the diagramming tool. The relationship between tblPrimary and
> tblRoadTrip is one-to-many and the linking filed is LinkID. In
> tblPrimary, LinkID is set as the primary key.
> Any hints on where I can go to get information on how to solve this
> problem will be greatly appreciated!
> Thanks!
> Don
>
>|||Figuring that bad data might be a cause, I finally found the problem with
some invalid dates. While the MS Access table used date fields, looks like
it is much more forgiving in terms of mis-entered dates.
Don
"Don" <someone@.somewhere.net> wrote in message
news:OYLs7FSwFHA.3300@.TK2MSFTNGP09.phx.gbl...
> Okay, I think I found the problem, we sort of ......
> The table tblPrimary is empty! I went back to the Upsizing Wizard Report,
> and low and behold the following message "Table was skipped, or export
> failed". Will very authoritative, lacking in any information to diagnose
> why the table was skipped or the export failed. I tried re-exporting the
> table all by itself, and the report for that says "skipping table
> 'tblPrimary'".
> What causes a file to be skipped during the upsizing wizard process?
> Don
>
>
> "Don" <someone@.somewhere.net> wrote in message
> news:e40TnYRwFHA.2656@.TK2MSFTNGP09.phx.gbl...
>

Newbie Basic Question - DISTINCT & PKs

Could somebody please clarify this simple question for me? I'm clearly missing something basic...

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!