Showing posts with label copied. Show all posts
Showing posts with label copied. Show all posts

Sunday, February 19, 2012

adding DB from another computer

Hi!
I have copied from other computer, from location "C:\Program Files\Microsoft
SQL Server\MSSQL.2\MSSQL\Data" files my_db.mdf and md_db_log.ldf to other
computer to the same location, and I can't see this DB. How can I import DB
using files above?
Regards,
AreqYOu will either have to attach the database using the GUI commands for that
(Right Click on the server, either in EM or SSMS) and select attach
database, then select the appropiate database files, or use the TSQL command
sp_attachdb to attach the files. See more details about the TSQL command in
the BOL (SQL Server Help files).
Jens K. Suessmeyer.
--
http://www.sqlserver2005.de
--
"Areq" <areq@.op.com> wrote in message
news:eu1h3n$kqe$1@.nemesis.news.tpi.pl...
> Hi!
> I have copied from other computer, from location "C:\Program
> Files\Microsoft SQL Server\MSSQL.2\MSSQL\Data" files my_db.mdf and
> md_db_log.ldf to other computer to the same location, and I can't see this
> DB. How can I import DB using files above?
> Regards,
> Areq
>|||Areq,
Check BOL for sp_attach_db. That is probably what you need.
-- Bill
"Areq" <areq@.op.com> wrote in message
news:eu1h3n$kqe$1@.nemesis.news.tpi.pl...
> Hi!
> I have copied from other computer, from location "C:\Program
> Files\Microsoft SQL Server\MSSQL.2\MSSQL\Data" files my_db.mdf and
> md_db_log.ldf to other computer to the same location, and I can't see this
> DB. How can I import DB using files above?
> Regards,
> Areq
>|||Use sp_attach_db
Here is an example from BOL
EXEC sp_attach_db @.dbname = N'pubs',
@.filename1 = N'c:\Program Files\Microsoft SQL
Server\MSSQL\Data\pubs.mdf',
@.filename2 = N'c:\Program Files\Microsoft SQL
Server\MSSQL\Data\pubs_log.ldf'
Jack Vamvas
___________________________________
Advertise your IT vacancies for free at - http://www.ITjobfeed.com
"Areq" <areq@.op.com> wrote in message
news:eu1h3n$kqe$1@.nemesis.news.tpi.pl...
> Hi!
> I have copied from other computer, from location "C:\Program
> Files\Microsoft SQL Server\MSSQL.2\MSSQL\Data" files my_db.mdf and
> md_db_log.ldf to other computer to the same location, and I can't see this
> DB. How can I import DB using files above?
> Regards,
> Areq
>

adding DB from another computer

Hi!
I have copied from other computer, from location "C:\Program Files\Microsoft
SQL Server\MSSQL.2\MSSQL\Data" files my_db.mdf and md_db_log.ldf to other
computer to the same location, and I can't see this DB. How can I import DB
using files above?
Regards,
AreqYOu will either have to attach the database using the GUI commands for that
(Right Click on the server, either in EM or SSMS) and select attach
database, then select the appropiate database files, or use the TSQL command
sp_attachdb to attach the files. See more details about the TSQL command in
the BOL (SQL Server Help files).
Jens K. Suessmeyer.
http://www.sqlserver2005.de
--
"Areq" <areq@.op.com> wrote in message
news:eu1h3n$kqe$1@.nemesis.news.tpi.pl...
> Hi!
> I have copied from other computer, from location "C:\Program
> Files\Microsoft SQL Server\MSSQL.2\MSSQL\Data" files my_db.mdf and
> md_db_log.ldf to other computer to the same location, and I can't see this
> DB. How can I import DB using files above?
> Regards,
> Areq
>|||Areq,
Check BOL for sp_attach_db. That is probably what you need.
-- Bill
"Areq" <areq@.op.com> wrote in message
news:eu1h3n$kqe$1@.nemesis.news.tpi.pl...
> Hi!
> I have copied from other computer, from location "C:\Program
> Files\Microsoft SQL Server\MSSQL.2\MSSQL\Data" files my_db.mdf and
> md_db_log.ldf to other computer to the same location, and I can't see this
> DB. How can I import DB using files above?
> Regards,
> Areq
>|||Use sp_attach_db
Here is an example from BOL
EXEC sp_attach_db @.dbname = N'pubs',
@.filename1 = N'c:\Program Files\Microsoft SQL
Server\MSSQL\Data\pubs.mdf',
@.filename2 = N'c:\Program Files\Microsoft SQL
Server\MSSQL\Data\pubs_log.ldf'
Jack Vamvas
___________________________________
Advertise your IT vacancies for free at - http://www.ITjobfeed.com
"Areq" <areq@.op.com> wrote in message
news:eu1h3n$kqe$1@.nemesis.news.tpi.pl...
> Hi!
> I have copied from other computer, from location "C:\Program
> Files\Microsoft SQL Server\MSSQL.2\MSSQL\Data" files my_db.mdf and
> md_db_log.ldf to other computer to the same location, and I can't see this
> DB. How can I import DB using files above?
> Regards,
> Areq
>

Monday, February 13, 2012

Adding column problem

I consulted the SQL2K help for adding a table and copied the code and
substituted my own variables, but I get an error message about incorrect
syntax regarding the AS in line 1. I'm a newbie and am bummed that the code
provided in the help doesn't work--I'm assuming there's something I don't
know here. Here's the code:
---
Dim t_AssessmentItem As SQLDMO.Table
Dim OutputAssessmentLevelID As New SQLDMO.Column
OutputAssessmentLevelID.Name = "ShelfLife"
OutputAssessmentLevelID.Datatype = "CodeID"
OutputAssessmentLevelID.AllowNulls = False
OutputAssessmentLevelID.DRIDefault.Int = "AssessmentLevelID"
Set t_AssessmentItem = _
oSQLServer.Databases("PowerSuasionDevLocal").Tables("t_AssessmentItem")
t_AssessmentItem.BeginAlter
t_AssessmentItem.Columns.Add OutputAssessmentLevelID
t_AssessmentItem.DoAlter
--
Thanks for your help,
karolus> OutputAssessmentLevelID.DRIDefault.Int = "AssessmentLevelID"
I don't see an Int property for the DRIDefault object. You might try
specifying a default constraint name and value instead. For example:
OutputAssessmentLevelID.DRIDefault.Name = "DF_t_AssessmentItem_ShelfLife"
OutputAssessmentLevelID.DRIDefault.Text = "0"
Hope this helps.
Dan Guzman
SQL Server MVP
"Karolus" <Karolus@.discussions.microsoft.com> wrote in message
news:DA68ACB7-098B-4282-92C6-23A24E024C1B@.microsoft.com...
>I consulted the SQL2K help for adding a table and copied the code and
> substituted my own variables, but I get an error message about incorrect
> syntax regarding the AS in line 1. I'm a newbie and am bummed that the
> code
> provided in the help doesn't work--I'm assuming there's something I don't
> know here. Here's the code:
> ---
> Dim t_AssessmentItem As SQLDMO.Table
> Dim OutputAssessmentLevelID As New SQLDMO.Column
> OutputAssessmentLevelID.Name = "ShelfLife"
> OutputAssessmentLevelID.Datatype = "CodeID"
> OutputAssessmentLevelID.AllowNulls = False
> OutputAssessmentLevelID.DRIDefault.Int = "AssessmentLevelID"
> Set t_AssessmentItem = _
> oSQLServer.Databases("PowerSuasionDevLocal").Tables("t_AssessmentItem")
> t_AssessmentItem.BeginAlter
> t_AssessmentItem.Columns.Add OutputAssessmentLevelID
> t_AssessmentItem.DoAlter
> --
> Thanks for your help,
> karolus|||"Karolus" <Karolus@.discussions.microsoft.com> wrote in message
news:DA68ACB7-098B-4282-92C6-23A24E024C1B@.microsoft.com...
> I consulted the SQL2K help for adding a table and copied the code
and
> substituted my own variables, but I get an error message about
incorrect
> syntax regarding the AS in line 1. I'm a newbie and am bummed that
the code
> provided in the help doesn't work--I'm assuming there's something I
don't
> know here. Here's the code:
> ---
> Dim t_AssessmentItem As SQLDMO.Table
> Dim OutputAssessmentLevelID As New SQLDMO.Column
> OutputAssessmentLevelID.Name = "ShelfLife"
> OutputAssessmentLevelID.Datatype = "CodeID"
> OutputAssessmentLevelID.AllowNulls = False
> OutputAssessmentLevelID.DRIDefault.Int = "AssessmentLevelID"
> Set t_AssessmentItem = _
>
oSQLServer.Databases("PowerSuasionDevLocal").Tables("t_AssessmentItem"
)
> t_AssessmentItem.BeginAlter
> t_AssessmentItem.Columns.Add OutputAssessmentLevelID
> t_AssessmentItem.DoAlter
> --
> Thanks for your help,
> karolus
Karolus,
You say your problem is about "incorrect syntax regard the AS in line
1".
It looks like you are using VB/VBA. Have you set a reference to the
"Microsoft SQLDMO Object Library"?
If you haven't, then "SQLDMO.Column" will not work.
Check:
VBA = Tools > References
VB = Project > References
Sincerely,
Chris O.