Showing posts with label hii. Show all posts
Showing posts with label hii. Show all posts

Monday, March 26, 2012

Making random names!

Hi
I have no idea but want to learn it how to make random names with sql server...
I have a table, called table1, for colums Firstname and Last name
I want it to make random names, so much it is possible it can get, in table2 where the colums is named Names
PLEASE HELP :)

knuff--

Regardign this...

knuff wrote:

...I have no idea but want to learn it how to make random names with sql server...

...I say, I am just guessing (and yet I think this is quite possible)...

...I expect that one could use these TSQL functions...

RAND ( [ seed ] )
Returns a random float value from 0 through 1.

ROUND ( numeric_expression , length [ , function ] )
Returns a numeric expression, rounded to the specified length or precision.

CHAR ( int )
A string function that converts an int ASCII code to a character.

...and some string contatenation to get the job done.

That said, I will add that doing something like this is MUCH better suited to middle-tier logic rather than the database, IMHO.

HTH.

Thank you.

--Mark Kamoski

|||Ok... Sounds logical to me what you wrote there i can try out of that

Friday, March 23, 2012

making a sql backup file a database

Hi
I have copied a sql server backup file. I would like to make it a live database. How would I do this??Use RESTORE statement to restore as database.
Refer to books online for more information.|||Originally posted by Satya
Use RESTORE statement to restore as database.
Refer to books online for more information.

I actually made a backup of one of our live databases...lets call it database1....I would like the backup to be identical to Database1 BUT called database2. The main reason for this is i want to do tests on it...

Thanks

Charlene|||Can you describe "backup" in a bit more detail? Is this a SQL backup (to a dump file), or an NT file backup?

-PatP|||Originally posted by Pat Phelan
Can you describe "backup" in a bit more detail? Is this a SQL backup (to a dump file), or an NT file backup?

-PatP

On one of databases in Server Enterprise Manager, I right clicked on the database and I made a full backup.....this is what i currently have as my backup......

Charlene|||Ah, way more gooder yet even! ;)

There are more ways to skin this cat than there are cats, but I'll give you a simple scenario.

1) Go into SQL Enterprise Mangler.
2) Create a new database on your server
3) Right click on the new database
4) Click restore from the pop-up menu
5) Select the dump file that you created

...and you should be in business!

-PatP|||Originally posted by Pat Phelan
Ah, way more gooder yet even! ;)

There are more ways to skin this cat than there are cats, but I'll give you a simple scenario.

1) Go into SQL Enterprise Mangler.
2) Create a new database on your server
3) Right click on the new database
4) Click restore from the pop-up menu
5) Select the dump file that you created

...and you should be in business!

-PatP

Thank you sooo much...you are a great help/////|||Oh, I just love it when a pretty lady says that!

-PatP|||Actually, you can skip steps 1 through 3 and restore a db to a different name (Hoping for a "Thank you sooo much" here...:rolleyes: )|||Thank you soooo much!

Oops, hold on a second. Probably not where you wanted that to come from. Sorry ;)

That actually would be how I'd do it, but that isn't as "easy" for somebody from the GUI world.

-PatP|||Originally posted by Pat Phelan
Thank you soooo much!

Oops, hold on a second. Probably not where you wanted that to come from. Sorry ;)

That actually would be how I'd do it, but that isn't as "easy" for somebody from the GUI world.

-PatP

Cool....you guys are all great...I am very impressed with the help...|||Originally posted by charla
Cool....you guys are all great...I am very impressed with the help...

One more problem...where must my database .bak file be placed, because I cannot select the file i want to make a backup of...|||Originally posted by charla
One more problem...where must my database .bak file be placed, because I cannot select the file i want to make a backup of...

This is not working....can someone please guide me step by step through the process of making a backup of a database that is sitting on one of my remote servers. Then creating a copy of this database on a local machine.

Thanks|||Why not review information from books online for BACKUP & RESTORE statements.

Monday, February 20, 2012

maintenance plan reports delete backup file fail but deletes it ok

Hi
I have a sql 2000 sp4 maintenance plan that is set to delete old dbs
over 2 days old. In the maintenance plan history it reports this
activity failing for one db, but the Message section reports 1 file
deleted. The transaction log backup delete works ok and reports
correctly. Any ideas?
Kev
Hey Kev,
(Don'cha hate it when no one replies to your question?) :-)
Even though the History states failure, does the physical file actually get
deleted, though? I've seen several times the "work" gets done even though
sqlmaint (for some reason) has problems and fails. I've never really paid
much attention to the History, myself. Maybe I should. But I always
right-click on the job (if it show failure) and check the jobsteps. Then, I
check the output file created by the Plan's job (backup, optimization, etc.).
Could you send the few lines of output from both the History (may need to
manually type) and the Message section of the output? Manybe I can see
something from them.
Thanks
TJ
"nsiadmin" wrote:

> Hi
> I have a sql 2000 sp4 maintenance plan that is set to delete old dbs
> over 2 days old. In the maintenance plan history it reports this
> activity failing for one db, but the Message section reports 1 file
> deleted. The transaction log backup delete works ok and reports
> correctly. Any ideas?
> Kev
>
|||On 21 Mar, 14:50, ToeJam <Toe...@.discussions.microsoft.com> wrote:[vbcol=seagreen]
> Hey Kev,
> (Don'cha hate it when no one replies to your question?) :-)
> Even though the History states failure, does the physical file actually get
> deleted, though? I've seen several times the "work" gets done even though
> sqlmaint (for some reason) has problems and fails. I've never really paid
> much attention to the History, myself. Maybe I should. But I always
> right-click on the job (if it show failure) and check the jobsteps. Then, I
> check the output file created by the Plan's job (backup, optimization, etc.).
> Could you send the few lines of output from both the History (may need to
> manually type) and the Message section of the output? Manybe I can see
> something from them.
> Thanks
> TJ
> "nsiadmin" wrote:
>
Hi TJ
thanks for your reply.
this is the log file from the maint job :
Microsoft (R) SQLMaint Utility (Unicode), Version Logged on to SQL
Server 'MHA-SQL01\SQL01' as 'MHACAREGROUP\CLU01SQLSVC' (trusted)
Starting maintenance plan 'MHA CareG1_SITE Mtnce plan' on 19/03/2007
20:00:02
[1] Database MHACareG1_SITE: Transaction Log Backup...
Destination: [G:\Program Files\Microsoft SQL Server\MSSQL
$SQL01\BACKUP\MHACareG1_SITE\MHACareG1_SITE_tlog_2 00703192000.TRN]
** Execution Time: 0 hrs, 0 mins, 9 secs **
[2] Database MHACareG1_SITE: Delete Old Backup Files...
2 file(s) deleted.
Deleting old text reports... 1 file(s) deleted.
End of maintenance plan 'MHA CareG1_SITE Mtnce plan' on 19/03/2007
20:00:11
SQLMAINT.EXE Process Exit Code: 0 (Success)
yet the maintenance plan history records :
Db Activity Status
End date Message
MHACareG1_site Delete old db backups X 19/03/07 20:31
2 files deleted
so it appears to do exactly what it says, but still reports it as
failed.
I am going to set up a new maint plan for this db to a different
folder with exactly the same details
Kev
|||That is interesting, not to mention odd.
Question; What else does this Maint. Plan do besides the TLog backup?
The job output states that the job (or step?) begins @. 20:00:02 and finishes
@. 20:00:11 (Execution Time: 9 secs). BUT, the History record shows the End
date (time) as 20:31. What else occurred within those 31 minutes? A
Database Backup, or an Optimization perhaps? Maybe it was one of those that
actually failed. Or are there any other Steps within the same Job?
TJ
"nsiadmin" wrote:

> On 21 Mar, 14:50, ToeJam <Toe...@.discussions.microsoft.com> wrote:
> Hi TJ
> thanks for your reply.
> this is the log file from the maint job :
> Microsoft (R) SQLMaint Utility (Unicode), Version Logged on to SQL
> Server 'MHA-SQL01\SQL01' as 'MHACAREGROUP\CLU01SQLSVC' (trusted)
> Starting maintenance plan 'MHA CareG1_SITE Mtnce plan' on 19/03/2007
> 20:00:02
> [1] Database MHACareG1_SITE: Transaction Log Backup...
> Destination: [G:\Program Files\Microsoft SQL Server\MSSQL
> $SQL01\BACKUP\MHACareG1_SITE\MHACareG1_SITE_tlog_2 00703192000.TRN]
> ** Execution Time: 0 hrs, 0 mins, 9 secs **
> [2] Database MHACareG1_SITE: Delete Old Backup Files...
> 2 file(s) deleted.
> Deleting old text reports... 1 file(s) deleted.
> End of maintenance plan 'MHA CareG1_SITE Mtnce plan' on 19/03/2007
> 20:00:11
> SQLMAINT.EXE Process Exit Code: 0 (Success)
> yet the maintenance plan history records :
> Db Activity Status End date Message
> MHACareG1_site Delete old db backups X 19/03/07 20:31 2 files deleted
> so it appears to do exactly what it says, but still reports it as
> failed.
> I am going to set up a new maint plan for this db to a different
> folder with exactly the same details
> Kev
>
|||Hi Tj,
yes it does a db backup which works ok. The History record refers only
to the delete old files part of the job which ran at 20:31. All the
steps within the maint job are listed in the history as separate
activities, but only delete old files step fails.
Interestingly I set up the new job to run overnight, created 2 old
files in the destination folder, and everything worked ok.
Sometimes I guess its easier to just start again and forget it.
Cheers
Kev
On 21 Mar, 16:18, ToeJam <Toe...@.discussions.microsoft.com> wrote:[vbcol=seagreen]
> That is interesting, not to mention odd.
> Question; What else does this Maint. Plan do besides the TLog backup?
> The job output states that the job (or step?) begins @. 20:00:02 and finishes
> @. 20:00:11 (Execution Time: 9 secs). BUT, the History record shows the End
> date (time) as 20:31. What else occurred within those 31 minutes? A
> Database Backup, or an Optimization perhaps? Maybe it was one of those that
> actually failed. Or are there any other Steps within the same Job?
> TJ
> "nsiadmin" wrote:
>
>
>
>
>
>
>
>
>

maintenance plan reports delete backup file fail but deletes it ok

Hi
I have a sql 2000 sp4 maintenance plan that is set to delete old dbs
over 2 days old. In the maintenance plan history it reports this
activity failing for one db, but the Message section reports 1 file
deleted. The transaction log backup delete works ok and reports
correctly. Any ideas?
KevHey Kev,
(Don'cha hate it when no one replies to your question') :-)
Even though the History states failure, does the physical file actually get
deleted, though? I've seen several times the "work" gets done even though
sqlmaint (for some reason) has problems and fails. I've never really paid
much attention to the History, myself. Maybe I should. But I always
right-click on the job (if it show failure) and check the jobsteps. Then, I
check the output file created by the Plan's job (backup, optimization, etc.)
.
Could you send the few lines of output from both the History (may need to
manually type) and the Message section of the output? Manybe I can see
something from them.
Thanks
TJ
"nsiadmin" wrote:

> Hi
> I have a sql 2000 sp4 maintenance plan that is set to delete old dbs
> over 2 days old. In the maintenance plan history it reports this
> activity failing for one db, but the Message section reports 1 file
> deleted. The transaction log backup delete works ok and reports
> correctly. Any ideas?
> Kev
>|||On 21 Mar, 14:50, ToeJam <Toe...@.discussions.microsoft.com> wrote:[vbcol=seagreen]
> Hey Kev,
> (Don'cha hate it when no one replies to your question') :-)
> Even though the History states failure, does the physical file actually ge
t
> deleted, though? I've seen several times the "work" gets done even though
> sqlmaint (for some reason) has problems and fails. I've never really paid
> much attention to the History, myself. Maybe I should. But I always
> right-click on the job (if it show failure) and check the jobsteps. Then,
I
> check the output file created by the Plan's job (backup, optimization, etc
.).
> Could you send the few lines of output from both the History (may need to
> manually type) and the Message section of the output? Manybe I can see
> something from them.
> Thanks
> TJ
> "nsiadmin" wrote:
>
>
Hi TJ
thanks for your reply.
this is the log file from the maint job :
Microsoft (R) SQLMaint Utility (Unicode), Version Logged on to SQL
Server 'MHA-SQL01\SQL01' as 'MHACAREGROUP\CLU01SQLSVC' (trusted)
Starting maintenance plan 'MHA CareG1_SITE Mtnce plan' on 19/03/2007
20:00:02
[1] Database MHACareG1_SITE: Transaction Log Backup...
Destination: [G:\Program Files\Microsoft SQL Server\MSSQL
$SQL01\BACKUP\MHACareG1_SITE\MHACareG1_S
ITE_tlog_200703192000.TRN]
** Execution Time: 0 hrs, 0 mins, 9 secs **
[2] Database MHACareG1_SITE: Delete Old Backup Files...
2 file(s) deleted.
Deleting old text reports... 1 file(s) deleted.
End of maintenance plan 'MHA CareG1_SITE Mtnce plan' on 19/03/2007
20:00:11
SQLMAINT.EXE Process Exit Code: 0 (Success)
yet the maintenance plan history records :
Db Activity Status
End date Message
MHACareG1_site Delete old db backups X 19/03/07 20:31
2 files deleted
so it appears to do exactly what it says, but still reports it as
failed.
I am going to set up a new maint plan for this db to a different
folder with exactly the same details
Kev