Showing posts with label contains. Show all posts
Showing posts with label contains. Show all posts

Wednesday, March 28, 2012

newbie question - sp help

hi all,

i need some helpful advise from you.
i need to write a sp that you may be able to help me with.

i have a table that only contains a numeric field. i need to write a
sp that, when executed, the numberic field increments by one and then
returns the new numeric. i have looked on the net for this, but have
not had any look...

can you please help in any way? i know nothing about writing sp's!

- hollis..Try something like:
/***********START SP

CREATE PROCEDURE numberTest @.numberIn int

AS

declare @.numberOut int

set @.numberOut = @.numberIn + 1

print @.numberOut

/***********END SP

You will need to manupulate to fit in excatly with what you need

JV
__________________________________________________ _________________
Remotely manage MS SQL db with SQLdirector -
www.ciquery.com/tools/sqldirector/

"Hollis" <hollis_uk@.lycos.co.uk> wrote in message
news:98c2c468.0309091201.50cd813d@.posting.google.c om...
> hi all,
> i need some helpful advise from you.
> i need to write a sp that you may be able to help me with.
> i have a table that only contains a numeric field. i need to write a
> sp that, when executed, the numberic field increments by one and then
> returns the new numeric. i have looked on the net for this, but have
> not had any look...
> can you please help in any way? i know nothing about writing sp's!
> - hollis..|||hollis_uk@.lycos.co.uk (Hollis) wrote in message news:<98c2c468.0309091201.50cd813d@.posting.google.com>...
> hi all,
> i need some helpful advise from you.
> i need to write a sp that you may be able to help me with.
> i have a table that only contains a numeric field. i need to write a
> sp that, when executed, the numberic field increments by one and then
> returns the new numeric. i have looked on the net for this, but have
> not had any look...
> can you please help in any way? i know nothing about writing sp's!
> - hollis..

This is one possible way:

create proc dbo.GetNextID
@.NextID int output
as
update dbo.MyTable
set @.NextID = NumericColumn = NumericColumn + 1
go

declare @.id int
exec dbo.GetNextID @.NextID = @.id output
select @.id
go

Simon

Saturday, February 25, 2012

newbie - have backup file and trn file - how do I get it up and going?

Hello there,
I have a project to look into where I need to look into an MSSQL database.
I have been sent a file that contains a BAK file and a TRN file. I am told
this is a dump of the MSSQL database.
I have installed the evaluation version of SQL Server 2000 database onto my
Windows 2000 PC.
My first question is, am I going about it the right way, and what is the
first thing I want to do with regard to actually opening the database.
I looked into the Enterprise manager about restoring a database, but it did
not seem to let me choose a file location to restore from.
Any guidance or input would be appreciated.
Kind regards
Dave.Check out RESTORE DATABASE and RESTORE LOG in the BOL.
--
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Toronto, ON Canada
.
"David Smithz" <dave1900@.blueyonder.co.uk> wrote in message
news:HR%5g.63459$wl.12794@.text.news.blueyonder.co.uk...
Hello there,
I have a project to look into where I need to look into an MSSQL database.
I have been sent a file that contains a BAK file and a TRN file. I am told
this is a dump of the MSSQL database.
I have installed the evaluation version of SQL Server 2000 database onto my
Windows 2000 PC.
My first question is, am I going about it the right way, and what is the
first thing I want to do with regard to actually opening the database.
I looked into the Enterprise manager about restoring a database, but it did
not seem to let me choose a file location to restore from.
Any guidance or input would be appreciated.
Kind regards
Dave.|||It is probably easiest for you to read about the below commands in Books Online
RESTORE HEADERONLY
RESTORE FILELISTONLY
Use above two to investigate what is on those backup files. Then do the restore operations using
RESTORE DATABASE
RESTORE LOG
You probably have to use the MOVE option for above commands, guided but he output from RESTORE
FILELISTONLY.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"David Smithz" <dave1900@.blueyonder.co.uk> wrote in message
news:HR%5g.63459$wl.12794@.text.news.blueyonder.co.uk...
> Hello there,
> I have a project to look into where I need to look into an MSSQL database.
> I have been sent a file that contains a BAK file and a TRN file. I am told this is a dump of the
> MSSQL database.
> I have installed the evaluation version of SQL Server 2000 database onto my Windows 2000 PC.
> My first question is, am I going about it the right way, and what is the first thing I want to do
> with regard to actually opening the database.
> I looked into the Enterprise manager about restoring a database, but it did not seem to let me
> choose a file location to restore from.
> Any guidance or input would be appreciated.
> Kind regards
> Dave.
>
>

newbie - have backup file and trn file - how do I get it up and going?

Hello there,
I have a project to look into where I need to look into an MSSQL database.
I have been sent a file that contains a BAK file and a TRN file. I am told
this is a dump of the MSSQL database.
I have installed the evaluation version of SQL Server 2000 database onto my
Windows 2000 PC.
My first question is, am I going about it the right way, and what is the
first thing I want to do with regard to actually opening the database.
I looked into the Enterprise manager about restoring a database, but it did
not seem to let me choose a file location to restore from.
Any guidance or input would be appreciated.
Kind regards
Dave.Check out RESTORE DATABASE and RESTORE LOG in the BOL.
Tom
----
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Toronto, ON Canada
.
"David Smithz" <dave1900@.blueyonder.co.uk> wrote in message
news:HR%5g.63459$wl.12794@.text.news.blueyonder.co.uk...
Hello there,
I have a project to look into where I need to look into an MSSQL database.
I have been sent a file that contains a BAK file and a TRN file. I am told
this is a dump of the MSSQL database.
I have installed the evaluation version of SQL Server 2000 database onto my
Windows 2000 PC.
My first question is, am I going about it the right way, and what is the
first thing I want to do with regard to actually opening the database.
I looked into the Enterprise manager about restoring a database, but it did
not seem to let me choose a file location to restore from.
Any guidance or input would be appreciated.
Kind regards
Dave.|||It is probably easiest for you to read about the below commands in Books Onl
ine
RESTORE HEADERONLY
RESTORE FILELISTONLY
Use above two to investigate what is on those backup files. Then do the rest
ore operations using
RESTORE DATABASE
RESTORE LOG
You probably have to use the MOVE option for above commands, guided but he o
utput from RESTORE
FILELISTONLY.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"David Smithz" <dave1900@.blueyonder.co.uk> wrote in message
news:HR%5g.63459$wl.12794@.text.news.blueyonder.co.uk...
> Hello there,
> I have a project to look into where I need to look into an MSSQL database.
> I have been sent a file that contains a BAK file and a TRN file. I am told
this is a dump of the
> MSSQL database.
> I have installed the evaluation version of SQL Server 2000 database onto m
y Windows 2000 PC.
> My first question is, am I going about it the right way, and what is the f
irst thing I want to do
> with regard to actually opening the database.
> I looked into the Enterprise manager about restoring a database, but it di
d not seem to let me
> choose a file location to restore from.
> Any guidance or input would be appreciated.
> Kind regards
> Dave.
>
>