From marklbreen at gmail.com Thu Mar 1 03:05:18 2012 From: marklbreen at gmail.com (Mark Breen) Date: Thu, 1 Mar 2012 09:05:18 +0000 Subject: [dba-SQLServer] Restoring backups In-Reply-To: References: <4F4E79D4.2020003@colbyconsulting.com> Message-ID: Hello All, Another link that may be useful is Expressmaint I am using this for a year or two now on some express machines, but I expect that it will work just as well on full SQL Server. It does not help John with the restores, but the sproc is available on the codeplex site and there may be code there worth reading. I have a file in my documents named backup.sql and it simple contains the code to backup a number of databases. When I am working and want to make a quick snapshot of my current db, I open the file, ensure that only one DB is included in the Set statements of a variable and press F5. I find it faster than using the GUI. Mark On 29 February 2012 21:54, Jim Lawrence wrote: > Hi John: > > Here is something that was recently posted with compiled(bin) and source > versions for download from Codeproject. It has modules for both backup and > restore written in Server Management Objects. > > > http://www.codeproject.com/Articles/123441/SQL-Server-2008-Backup-and-Restor > e-Databases-using > > Whether it is a better solution or not I am not sure as I just use an > automated drive image product and regular command line copies for data as I > have no major databases on site. > > Thank Shamil for posting the original link. > > work? > > Jim > > -----Original Message----- > From: dba-sqlserver-bounces at databaseadvisors.com > [mailto:dba-sqlserver-bounces at databaseadvisors.com] On Behalf Of jwcolby > Sent: Wednesday, February 29, 2012 11:18 AM > To: Sqlserver-Dba > Subject: [dba-SQLServer] Restoring backups > > Does anyone know of a utility to track backups of a database from the full, > each differential and > the log file backups and allow you to just point to one of the above > backups > and restore each piece > in order? IOW if I do a full backup Sunday night, a differential every > weekday night, and log > backups every 1/2 hour, I would like to point to the a log file backup > somehow (in a table?) and > have the software understand that the backup chain for that log backup > starts at the Sunday night > full and progresses through each intermediary backup? So I could click a > button and restore down > through the backup chain. > > Does such a thing exist? Is such a thing even possible? > > For the moment I am using the scripts from here: > > http://ola.hallengren.com/sql-server-backup.html > > They appear to perform exactly as claimed. I am able to get Full, DIFF and > LOG backups easily and > quickly. What I am missing is the ability to restore these things easily > and quickly. Restoring a > full is easy, after that not so easy. > > -- > John W. Colby > Colby Consulting > > Reality is what refuses to go away > when you do not believe in it > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From marklbreen at gmail.com Thu Mar 1 04:21:41 2012 From: marklbreen at gmail.com (Mark Breen) Date: Thu, 1 Mar 2012 10:21:41 +0000 Subject: [dba-SQLServer] Time Stamped Backups of SQL Server Message-ID: Hello All, Following on from Mr Colby's discussions about backups, I decided to upload a snippit of SQL I use every day. In summary, it makes a time stamped backup of whichever database I comment in or comment out. It is usually in my recent files. It works with express or standard and works with 2005 and 2008 / 2008 R2. Let me know if it should be improved. Thanks Mark From jwcolby at colbyconsulting.com Thu Mar 1 08:39:37 2012 From: jwcolby at colbyconsulting.com (jwcolby) Date: Thu, 01 Mar 2012 09:39:37 -0500 Subject: [dba-SQLServer] Restoring backups In-Reply-To: References: <4F4E79D4.2020003@colbyconsulting.com> Message-ID: <4F4F8A29.2040805@colbyconsulting.com> Jim, We wrote a custom backup solution in C# using SMO to use with the big SQL Server processing that I do. It only does a full backup however. It logs the backups into a table and that table is then used to find the backup files and restore them. I will take a look at this thing to see how it works and whether I can start from there for a "generic" solution. John W. Colby Colby Consulting Reality is what refuses to go away when you do not believe in it On 2/29/2012 4:54 PM, Jim Lawrence wrote: > http://www.codeproject.com/Articles/123441/SQL-Server-2008-Backup-and-Restor > e-Databases-using From erbachs at gmail.com Fri Mar 2 17:31:53 2012 From: erbachs at gmail.com (Steve Erbach) Date: Fri, 2 Mar 2012 17:31:53 -0600 Subject: [dba-SQLServer] Reporting in ASP.NET WITHOUT SSRS or Crystal In-Reply-To: References: Message-ID: Robert, A bit on the pricey side! Steve Erbach Neenah, WI On Wed, Feb 29, 2012 at 4:14 PM, Robert Stewart wrote: > I would also suggest taking a look at the DevExpress reporting tool. > It is very good. It compiles to a dll, so nothing else needed. > > At 02:33 PM 2/29/2012, you wrote: > >> Date: Mon, 27 Feb 2012 09:55:12 -0600 >> From: Steve Erbach >> To: Discussion concerning MS SQL Server >> >> > >> Subject: Re: [dba-SQLServer] Reporting in ASP.NET WITHOUT SSRS or >> Crystal >> Message-ID: >> > gmail.com >> > >> Content-Type: text/plain; charset=ISO-8859-1 >> >> >> Stuart, >> >> Very reasonable price! I'm going to download their eval and take a hard >> look at it. Thank you! >> >> Steve Erbach >> Neenah, WI >> > > From newsgrps at dalyn.co.nz Sun Mar 4 18:08:37 2012 From: newsgrps at dalyn.co.nz (David Emerson) Date: Mon, 05 Mar 2012 13:08:37 +1300 Subject: [dba-SQLServer] Invalid Object Name in Function Message-ID: <20120305000918.NENL1178.mta02.xtra.co.nz@David-PC.dalyn.co.nz> Team, I Have SQL2008 R2. The following function which is saved in the SQL database has the function name underlined in red with the error Invalid Object name. Does anyone know what the problem might be? It seems to be saved in the database under Scalar-valued functions but I can't get rid of the error. USE [iMIS10_MP] GO /****** Object: UserDefinedFunction [dbo].[fn_MobilFuelGetNextSEQN] Script Date: 03/05/2012 13:01:01 ******/ SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- ============================================= -- Author: David Emerson, Dalyn Software -- Created: 5/3/2012 -- ============================================= ALTER FUNCTION [dbo].[fn_MobilFuelGetNextSEQN] <- Error Invalid object name ( ) RETURNS int AS BEGIN DECLARE @Result int, @NewSeqn int EXEC @Result=dbo.sp_iboGetCounter 'Activity',1, at NewSeqn output RETURN @NewSeqn END Regards David Emerson Dalyn Software Ltd Wellington, New Zealand From marklbreen at gmail.com Mon Mar 5 02:57:01 2012 From: marklbreen at gmail.com (Mark Breen) Date: Mon, 5 Mar 2012 08:57:01 +0000 Subject: [dba-SQLServer] Invalid Object Name in Function In-Reply-To: <20120305000918.NENL1178.mta02.xtra.co.nz@David-PC.dalyn.co.nz> References: <20120305000918.NENL1178.mta02.xtra.co.nz@David-PC.dalyn.co.nz> Message-ID: Hi David, I have had to be careful in the past with the names I applied to the function and where I created it. Can you check if it is stored in your db, in the functions section and not in the master db? can you try specifying full path to rule that our [dbname].[dbowner].[functionname] To eliminate the nested sproc that is called, you can try to execute this ALTER FUNCTION [dbo].[fn_MobilFuelGetNextSEQN] -- <- Error Invalid object name ( ) RETURNS INT AS BEGIN DECLARE @Result INT , @NewSeqn INT BEGIN SET @Result = 1 SET @NewSeqn = 1 END RETURN @NewSeqn END Sorry I cannot suggest anything else. Mark On 5 March 2012 00:08, David Emerson wrote: > Team, > > I Have SQL2008 R2. > > The following function which is saved in the SQL database has the function > name underlined in red with the error Invalid Object name. Does anyone > know what the problem might be? > > It seems to be saved in the database under Scalar-valued functions but I > can't get rid of the error. > > USE [iMIS10_MP] > GO > /****** Object: UserDefinedFunction [dbo].[fn_**MobilFuelGetNextSEQN] > Script Date: 03/05/2012 13:01:01 ******/ > SET ANSI_NULLS ON > GO > SET QUOTED_IDENTIFIER ON > GO > -- ==============================**=============== > -- Author: David Emerson, Dalyn Software > -- Created: 5/3/2012 > -- ==============================**=============== > ALTER FUNCTION [dbo].[fn_**MobilFuelGetNextSEQN] <- Error > Invalid object name > ( > ) > RETURNS int > AS > BEGIN > > DECLARE @Result int, @NewSeqn int > > EXEC @Result=dbo.sp_iboGetCounter 'Activity',1, at NewSeqn output > > RETURN @NewSeqn > > END > > Regards > > David Emerson > Dalyn Software Ltd > Wellington, New Zealand ______________________________**_________________ > dba-SQLServer mailing list > dba-SQLServer@**databaseadvisors.com > http://databaseadvisors.com/**mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.**com > > From rls at WeBeDb.com Mon Mar 5 09:38:07 2012 From: rls at WeBeDb.com (Robert Stewart) Date: Mon, 05 Mar 2012 09:38:07 -0600 Subject: [dba-SQLServer] Reporting in ASP.NET WITHOUT SSRS or Crystal In-Reply-To: References: Message-ID: Not if you consider what the full version of Crystal and other non-SRS reporting tools cost. At 02:57 AM 3/5/2012, you wrote: >Date: Fri, 2 Mar 2012 17:31:53 -0600 >From: Steve Erbach >To: Discussion concerning MS SQL Server > >Subject: Re: [dba-SQLServer] Reporting in ASP.NET WITHOUT SSRS or > Crystal >Message-ID: > >Content-Type: text/plain; charset=ISO-8859-1 > >Robert, > >A bit on the pricey side! > >Steve Erbach >Neenah, WI Robert L. Stewart www.WeBeDb.com www.DBGUIDesign.com www.RLStewartPhotography.com From newsgrps at dalyn.co.nz Mon Mar 5 15:27:58 2012 From: newsgrps at dalyn.co.nz (David Emerson) Date: Tue, 06 Mar 2012 10:27:58 +1300 Subject: [dba-SQLServer] Invalid Object Name in Function In-Reply-To: References: <20120305000918.NENL1178.mta02.xtra.co.nz@David-PC.dalyn.co.nz> Message-ID: <20120305212856.DCPQ25323.mta03.xtra.co.nz@David-PC.dalyn.co.nz> Thanks Mark. When I went into the database this morning suddenly it was being recognised. Even though I refreshed the database yesterday it didn't recognise it. Maybe I should have tried closing and opening the database yesterday. David At 5/03/2012, Mark Breen wrote: >Hi David, > >I have had to be careful in the past with the names I applied to the >function and where I created it. > >Can you check if it is stored in your db, in the functions section and not >in the master db? > >can you try specifying full path to rule that our >[dbname].[dbowner].[functionname] > >To eliminate the nested sproc that is called, you can try to execute this > >ALTER FUNCTION [dbo].[fn_MobilFuelGetNextSEQN] -- <- Error >Invalid object name > ( ) >RETURNS INT >AS > BEGIN > > DECLARE @Result INT , > @NewSeqn INT > > BEGIN > SET @Result = 1 > SET @NewSeqn = 1 > END > > > RETURN @NewSeqn > > END > >Sorry I cannot suggest anything else. > >Mark > > >On 5 March 2012 00:08, David Emerson wrote: > > > Team, > > > > I Have SQL2008 R2. > > > > The following function which is saved in the SQL database has the function > > name underlined in red with the error Invalid Object name. Does anyone > > know what the problem might be? > > > > It seems to be saved in the database under Scalar-valued functions but I > > can't get rid of the error. > > > > USE [iMIS10_MP] > > GO > > /****** Object: UserDefinedFunction [dbo].[fn_**MobilFuelGetNextSEQN] > > Script Date: 03/05/2012 13:01:01 ******/ > > SET ANSI_NULLS ON > > GO > > SET QUOTED_IDENTIFIER ON > > GO > > -- ==============================**=============== > > -- Author: David Emerson, Dalyn Software > > -- Created: 5/3/2012 > > -- ==============================**=============== > > ALTER FUNCTION [dbo].[fn_**MobilFuelGetNextSEQN] <- Error > > Invalid object name > > ( > > ) > > RETURNS int > > AS > > BEGIN > > > > DECLARE @Result int, @NewSeqn int > > > > EXEC @Result=dbo.sp_iboGetCounter 'Activity',1, at NewSeqn output > > > > RETURN @NewSeqn > > > > END > > > > Regards > > > > David Emerson > > Dalyn Software Ltd > > Wellington, New Zealand ______________________________**_________________ > > dba-SQLServer mailing list > > dba-SQLServer@**databaseadvisors.com > > > http://databaseadvisors.com/**mailman/listinfo/dba-sqlserver > > http://www.databaseadvisors.**com > > > > >_______________________________________________ >dba-SQLServer mailing list >dba-SQLServer at databaseadvisors.com >http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >http://www.databaseadvisors.com From newsgrps at dalyn.co.nz Tue Mar 6 17:18:28 2012 From: newsgrps at dalyn.co.nz (David Emerson) Date: Wed, 07 Mar 2012 12:18:28 +1300 Subject: [dba-SQLServer] Invalid Object Name in Function In-Reply-To: References: <20120305000918.NENL1178.mta02.xtra.co.nz@David-PC.dalyn.co.nz> Message-ID: <20120306231922.HGP13489.mta01.xtra.co.nz@David-PC.dalyn.co.nz> For those who are interested, I found the solution: Edit -> IntelliSense -> Refresh Local Cache Regards David At 5/03/2012, Mark Breen wrote: >Hi David, > >I have had to be careful in the past with the names I applied to the >function and where I created it. > >Can you check if it is stored in your db, in the functions section and not >in the master db? > >can you try specifying full path to rule that our >[dbname].[dbowner].[functionname] > >To eliminate the nested sproc that is called, you can try to execute this > >ALTER FUNCTION [dbo].[fn_MobilFuelGetNextSEQN] -- <- Error >Invalid object name > ( ) >RETURNS INT >AS > BEGIN > > DECLARE @Result INT , > @NewSeqn INT > > BEGIN > SET @Result = 1 > SET @NewSeqn = 1 > END > > > RETURN @NewSeqn > > END > >Sorry I cannot suggest anything else. > >Mark > > >On 5 March 2012 00:08, David Emerson wrote: > > > Team, > > > > I Have SQL2008 R2. > > > > The following function which is saved in the SQL database has the function > > name underlined in red with the error Invalid Object name. Does anyone > > know what the problem might be? > > > > It seems to be saved in the database under Scalar-valued functions but I > > can't get rid of the error. > > > > USE [iMIS10_MP] > > GO > > /****** Object: UserDefinedFunction [dbo].[fn_**MobilFuelGetNextSEQN] > > Script Date: 03/05/2012 13:01:01 ******/ > > SET ANSI_NULLS ON > > GO > > SET QUOTED_IDENTIFIER ON > > GO > > -- ==============================**=============== > > -- Author: David Emerson, Dalyn Software > > -- Created: 5/3/2012 > > -- ==============================**=============== > > ALTER FUNCTION [dbo].[fn_**MobilFuelGetNextSEQN] <- Error > > Invalid object name > > ( > > ) > > RETURNS int > > AS > > BEGIN > > > > DECLARE @Result int, @NewSeqn int > > > > EXEC @Result=dbo.sp_iboGetCounter 'Activity',1, at NewSeqn output > > > > RETURN @NewSeqn > > > > END > > > > Regards > > > > David Emerson > > Dalyn Software Ltd > > Wellington, New Zealand ______________________________**_________________ From jwcolby at colbyconsulting.com Wed Mar 7 08:22:49 2012 From: jwcolby at colbyconsulting.com (jwcolby) Date: Wed, 07 Mar 2012 09:22:49 -0500 Subject: [dba-SQLServer] 3 emails from months ago Message-ID: <4F576F39.7040103@colbyconsulting.com> Just came into my Sqlserver-Dba inbox. And I thought the USPS was slow... ;) -- John W. Colby Colby Consulting Reality is what refuses to go away when you do not believe in it From fhtapia at gmail.com Wed Mar 7 08:40:49 2012 From: fhtapia at gmail.com (Francisco Tapia) Date: Wed, 7 Mar 2012 06:40:49 -0800 Subject: [dba-SQLServer] 3 emails from months ago In-Reply-To: <4F576F39.7040103@colbyconsulting.com> References: <4F576F39.7040103@colbyconsulting.com> Message-ID: sorry I hadn't noticed them before :) -Francisco http://bit.ly/sqlthis | Tsql and More... On Wed, Mar 7, 2012 at 06:22, jwcolby wrote: > Just came into my Sqlserver-Dba inbox. > > And I thought the USPS was slow... > > ;) > > -- > John W. Colby > Colby Consulting > > Reality is what refuses to go away > when you do not believe in it > > ______________________________**_________________ > dba-SQLServer mailing list > dba-SQLServer@**databaseadvisors.com > http://databaseadvisors.com/**mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.**com > > From fhtapia at gmail.com Wed Mar 7 08:47:08 2012 From: fhtapia at gmail.com (Francisco Tapia) Date: Wed, 7 Mar 2012 06:47:08 -0800 Subject: [dba-SQLServer] Database backups In-Reply-To: <4F495987.12311.7C938D3@stuart.lexacorp.com.pg> References: <4F49106A.90005@colbyconsulting.com> <4F495987.12311.7C938D3@stuart.lexacorp.com.pg> Message-ID: Stuart, if he's stating incremental but means differential (as what sql server provides) then you don't need every differential, just the last differential backup. In my environment the backup strategy that I setup I have this scenario, we have a few 2 tb databases running around, their too big to backup nightly so we do a monthly weekend full backup, followed by daily diff's until the end of the month. We also have 60% of log backup triggers setup so that we have a re-occuring automatic log backup, to prevent log file fill ups. This method has worked really well for us, and minimizes the number of log backups that we need to deal with throughout the day when we test our restores (yes we test, no use running a backup that you never test). Our test restore databases to our development server where we have our greenest dba push out a restore sequence. Yes we have scripts that do that, but they are suppose to know the process, so they run through at least one manual restore process every quarter, and at least 3 scripted restores throughout the month. This has ensured that they can always restore us no matter who is on shift. -Francisco http://bit.ly/sqlthis | Tsql and More... On Sat, Feb 25, 2012 at 13:58, Stuart McLachlan wrote: > On 25 Feb 2012 at 11:46, jwcolby wrote: > > > How does an incremental database backup work? I kinda have a picture in > my head, only the changed > > stuff is backed up, > > Correct, > > > to the same file (maybe?) and so forth. Not even sure if that is true. > > Normally to separate files > > > What about restores from? Is the entire thing restored? Only changes > from a specific date / time? > > > > You have to restore the last full backup AND THEN every subsequent > incremental backup in > order. > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From jwcolby at colbyconsulting.com Wed Mar 7 10:02:25 2012 From: jwcolby at colbyconsulting.com (jwcolby) Date: Wed, 07 Mar 2012 11:02:25 -0500 Subject: [dba-SQLServer] Database backups In-Reply-To: References: <4F49106A.90005@colbyconsulting.com> <4F495987.12311.7C938D3@stuart.lexacorp.com.pg> Message-ID: <4F578691.5030702@colbyconsulting.com> I do mean differential. So the differential is everything between the full and the time the differential is made? That would make things easier. How does the log file backups play into the restore sequence? Full, the latest diff, then latest log? John W. Colby Colby Consulting Reality is what refuses to go away when you do not believe in it On 3/7/2012 9:47 AM, Francisco Tapia wrote: > Stuart, > if he's stating incremental but means differential (as what sql server > provides) then you don't need every differential, just the last > differential backup. > > In my environment the backup strategy that I setup I have this scenario, we > have a few 2 tb databases running around, their too big to backup nightly > so we do a monthly weekend full backup, followed by daily diff's until the > end of the month. We also have 60% of log backup triggers setup so that we > have a re-occuring automatic log backup, to prevent log file fill ups. > This method has worked really well for us, and minimizes the number of log > backups that we need to deal with throughout the day when we test our > restores (yes we test, no use running a backup that you never test). > > > Our test restore databases to our development server where we have our > greenest dba push out a restore sequence. Yes we have scripts that do > that, but they are suppose to know the process, so they run through at > least one manual restore process every quarter, and at least 3 scripted > restores throughout the month. This has ensured that they can always > restore us no matter who is on shift. > > > > -Francisco > http://bit.ly/sqlthis | Tsql and More... > > > > > > On Sat, Feb 25, 2012 at 13:58, Stuart McLachlanwrote: > >> On 25 Feb 2012 at 11:46, jwcolby wrote: >> >>> How does an incremental database backup work? I kinda have a picture in >> my head, only the changed >>> stuff is backed up, >> >> Correct, >> >>> to the same file (maybe?) and so forth. Not even sure if that is true. >> >> Normally to separate files >> >>> What about restores from? Is the entire thing restored? Only changes >> from a specific date / time? >>> >> >> You have to restore the last full backup AND THEN every subsequent >> incremental backup in >> order. >> >> >> _______________________________________________ >> dba-SQLServer mailing list >> dba-SQLServer at databaseadvisors.com >> http://databaseadvisors.com/mailman/listinfo/dba-sqlserver >> http://www.databaseadvisors.com >> >> > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From davidmcafee at gmail.com Wed Mar 7 12:10:43 2012 From: davidmcafee at gmail.com (David McAfee) Date: Wed, 7 Mar 2012 10:10:43 -0800 Subject: [dba-SQLServer] Script Seems To Be Stuck in an Infinite Loop - Or Just Stuck In-Reply-To: References: <001301cc959f$b45b9020$1d12b060$@net> Message-ID: I didn't have a chance to look at your code, but this is something I have used in the past: ALTER FUNCTION dbo.isPrime (@i INT) RETURNS BIT AS BEGIN DECLARE @b BIT DECLARE @n INT SET @b=1 SET @n=@i-1 WHILE (@n>1) BEGIN IF @i%@n = 0 BEGIN SET @b=0 SET @n=1 END SET @n=@n-1 END RETURN @b END GO /* Call in this manner: SELECT dbo.isPrime (1), dbo.isPrime (2), dbo.isPrime (17), dbo.isPrime (21), dbo.isPrime (23), dbo.isPrime (1021) */ On Fri, Oct 28, 2011 at 11:30 AM, Alan Lawhon wrote: > I'm almost embarrassed to post this, but after two days of trying to debug > this, I'm near the screaming point. (Ha! Ha! I know . real programmers > don't scream, but I'm new to SQL Server 2008R2 - Express Edition, so I'm > experiencing routine growing pains.) > From fhtapia at gmail.com Wed Mar 7 12:52:30 2012 From: fhtapia at gmail.com (Francisco Tapia) Date: Wed, 7 Mar 2012 10:52:30 -0800 Subject: [dba-SQLServer] Database backups In-Reply-To: <4F578691.5030702@colbyconsulting.com> References: <4F49106A.90005@colbyconsulting.com> <4F495987.12311.7C938D3@stuart.lexacorp.com.pg> <4F578691.5030702@colbyconsulting.com> Message-ID: Its full backup latest diff and each log backup since the last diff backup. So if you have 15 log backups a day, 15 you need to restore. On Mar 7, 2012 8:04 AM, "jwcolby" wrote: > I do mean differential. > > So the differential is everything between the full and the time the > differential is made? That would make things easier. > > How does the log file backups play into the restore sequence? Full, the > latest diff, then latest log? > > John W. Colby > Colby Consulting > > Reality is what refuses to go away > when you do not believe in it > > On 3/7/2012 9:47 AM, Francisco Tapia wrote: > >> Stuart, >> if he's stating incremental but means differential (as what sql server >> provides) then you don't need every differential, just the last >> differential backup. >> >> In my environment the backup strategy that I setup I have this scenario, >> we >> have a few 2 tb databases running around, their too big to backup nightly >> so we do a monthly weekend full backup, followed by daily diff's until the >> end of the month. We also have 60% of log backup triggers setup so that >> we >> have a re-occuring automatic log backup, to prevent log file fill ups. >> This method has worked really well for us, and minimizes the number of log >> backups that we need to deal with throughout the day when we test our >> restores (yes we test, no use running a backup that you never test). >> >> >> Our test restore databases to our development server where we have our >> greenest dba push out a restore sequence. Yes we have scripts that do >> that, but they are suppose to know the process, so they run through at >> least one manual restore process every quarter, and at least 3 scripted >> restores throughout the month. This has ensured that they can always >> restore us no matter who is on shift. >> >> >> >> -Francisco >> http://bit.ly/sqlthis | Tsql and More... >> >> >> >> >> >> On Sat, Feb 25, 2012 at 13:58, Stuart McLachlan >> >wrote: >> >> On 25 Feb 2012 at 11:46, jwcolby wrote: >>> >>> How does an incremental database backup work? I kinda have a picture in >>>> >>> my head, only the changed >>> >>>> stuff is backed up, >>>> >>> >>> Correct, >>> >>> to the same file (maybe?) and so forth. Not even sure if that is true. >>>> >>> >>> Normally to separate files >>> >>> What about restores from? Is the entire thing restored? Only changes >>>> >>> from a specific date / time? >>> >>>> >>>> >>> You have to restore the last full backup AND THEN every subsequent >>> incremental backup in >>> order. >>> >>> >>> ______________________________**_________________ >>> dba-SQLServer mailing list >>> dba-SQLServer@**databaseadvisors.com >>> http://databaseadvisors.com/**mailman/listinfo/dba-sqlserver >>> http://www.databaseadvisors.**com >>> >>> >>> ______________________________**_________________ >> dba-SQLServer mailing list >> dba-SQLServer@**databaseadvisors.com >> http://databaseadvisors.com/**mailman/listinfo/dba-sqlserver >> http://www.databaseadvisors.**com >> >> >> > ______________________________**_________________ > dba-SQLServer mailing list > dba-SQLServer@**databaseadvisors.com > http://databaseadvisors.com/**mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.**com > > From fuller.artful at gmail.com Wed Mar 7 14:49:28 2012 From: fuller.artful at gmail.com (Arthur Fuller) Date: Wed, 7 Mar 2012 15:49:28 -0500 Subject: [dba-SQLServer] [AccessD] MySQL In-Reply-To: References: <4E752C1D.9060901@colbyconsulting.com> <4E75328E.20690.144B1BE3@stuart.lexacorp.com.pg> <4E775189.9040106@colbyconsulting.com> <4E786D82.80801@colbyconsulting.com> <4E78F16F.7010507@colbyconsulting.com> <2C422BAA32CC4A598E1A4C88462C1C0B@creativesystemdesigns.com> <4E793DA2.3050601@colbyconsulting.com> <4E79BF73.8070402@colbyconsulting.com> Message-ID: JC, It is somewhat foreign, to be sure. But you may get some useful help from our web site, which is (mostly) tied to our book on MySQL. There are several chapters available free, plus databases, and lots of sample queries of varying complexity. For a modest sum you can get the whole eBook + updates, or for a bit more, the whole dead-tree version. Bon voyage! -- Arthur Cell: 647.710.1314 Prediction is difficult, especially of the future. -- Niels Bohr From fuller.artful at gmail.com Wed Mar 7 14:56:44 2012 From: fuller.artful at gmail.com (Arthur Fuller) Date: Wed, 7 Mar 2012 15:56:44 -0500 Subject: [dba-SQLServer] Script Seems To Be Stuck in an Infinite Loop - Or Just Stuck In-Reply-To: References: <001301cc959f$b45b9020$1d12b060$@net> Message-ID: Pretty slick, David. About the only thing I can suggest is that we can skip all even numbers, by definition (if the upper limit is even, subtract 1 and thereafter 2; if it's odd, start there and subtract 2 each time). -- Arthur Cell: 647.710.1314 Prediction is difficult, especially of the future. -- Niels Bohr From jwcolby at colbyconsulting.com Mon Mar 12 12:27:11 2012 From: jwcolby at colbyconsulting.com (jwcolby) Date: Mon, 12 Mar 2012 13:27:11 -0400 Subject: [dba-SQLServer] SSDs with SQL Server Message-ID: <4F5E31EF.8040603@colbyconsulting.com> http://www.sqlservercentral.com/articles/SSD+Disks/69693/ -- John W. Colby Colby Consulting Reality is what refuses to go away when you do not believe in it From jwcolby at colbyconsulting.com Tue Mar 20 07:02:22 2012 From: jwcolby at colbyconsulting.com (jwcolby) Date: Tue, 20 Mar 2012 08:02:22 -0400 Subject: [dba-SQLServer] Pushing the Limits of Windows: Virtual Memory - Mark's Blog - Site Home - TechNet Blogs Message-ID: <4F6871CE.3010807@colbyconsulting.com> Just something I ran across. -- John W. Colby Colby Consulting Reality is what refuses to go away when you do not believe in it http://blogs.technet.com/b/markrussinovich/archive/2008/11/17/3155406.aspx From jwcolby at colbyconsulting.com Fri Mar 23 11:36:20 2012 From: jwcolby at colbyconsulting.com (jwcolby) Date: Fri, 23 Mar 2012 12:36:20 -0400 Subject: [dba-SQLServer] table definition file Message-ID: <4F6CA684.1000406@colbyconsulting.com> Guys, I got a database today which I suspect is a flat file, fixed width, pad right. I got a "table definition file" with hundreds of lines like: 365,Physical_Address_Results,varchar(50) Which is basically column number, field name, data type. Is there anything built in to SQL Server to take such a table definition file and create the table from it? Once created, something to pull the fixed width file into such table? The file itself is 270 GIGABYTES with a .txt extension. I am having a problem even seeing the contents. I imagine I can open it in SQL Server directly in the import wizard but I really don't want to have to manually go set up the fixed width import stuff from inside of that wizard. -- John W. Colby Colby Consulting Reality is what refuses to go away when you do not believe in it From jwcolby at colbyconsulting.com Fri Mar 23 12:39:21 2012 From: jwcolby at colbyconsulting.com (jwcolby) Date: Fri, 23 Mar 2012 13:39:21 -0400 Subject: [dba-SQLServer] New database from hell Message-ID: <4F6CB549.7080908@colbyconsulting.com> I received a new "database from hell" today. This one is actually CSV format. It came with a table specification which in no way matches the actual file. However it appears to be importing in with just a few minor changes to the default 50 character default field width that the SQL Server import wizard uses. The file came in a 24 gigabyte zip file. Expanded it is 250 gigs. Way to large for even UltraEdit (my tried and true champion) to open. So I was unable to preview the data. However I just used the SQL Server import wizard to open the file and start looking at it. SQL Server truly is an amazing piece of work. No firm idea yet on the number of rows though I was told well over 100 million. 430 columns. -- John W. Colby Colby Consulting Reality is what refuses to go away when you do not believe in it From stuart at lexacorp.com.pg Fri Mar 23 15:54:00 2012 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Sat, 24 Mar 2012 06:54:00 +1000 Subject: [dba-SQLServer] table definition file In-Reply-To: <4F6CA684.1000406@colbyconsulting.com> References: <4F6CA684.1000406@colbyconsulting.com> Message-ID: <4F6CE2E8.26257.325AABC1@stuart.lexacorp.com.pg> I'd just use a text editor with decent regexp find/replace (Crimson Editor?) to convert the list into a Create Table SQL query. It should only take a couple of minutes. Heck, if you want to send me the definition file, I will do a first pass on it for you. -- Stuart On 23 Mar 2012 at 12:36, jwcolby wrote: > Guys, > > I got a database today which I suspect is a flat file, fixed width, pad right. > > I got a "table definition file" with hundreds of lines like: > > 365,Physical_Address_Results,varchar(50) > > Which is basically column number, field name, data type. > > Is there anything built in to SQL Server to take such a table definition file and create the table > from it? > > Once created, something to pull the fixed width file into such table? > > The file itself is 270 GIGABYTES with a .txt extension. I am having a problem even seeing the > contents. I imagine I can open it in SQL Server directly in the import wizard but I really don't > want to have to manually go set up the fixed width import stuff from inside of that wizard. > > -- > John W. Colby > Colby Consulting > > Reality is what refuses to go away > when you do not believe in it > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From jwcolby at colbyconsulting.com Sat Mar 24 08:07:39 2012 From: jwcolby at colbyconsulting.com (jwcolby) Date: Sat, 24 Mar 2012 09:07:39 -0400 Subject: [dba-SQLServer] table definition file In-Reply-To: <4F6CE2E8.26257.325AABC1@stuart.lexacorp.com.pg> References: <4F6CA684.1000406@colbyconsulting.com> <4F6CE2E8.26257.325AABC1@stuart.lexacorp.com.pg> Message-ID: <4F6DC71B.9000808@colbyconsulting.com> Thanks for the offer Stuart. It turns out that the file was comma delimited CSV with the first line being field defs. I just imported the file using SQl Server's import wizard. Then it turns out that the table definition file didn't even remotely match the actual fields in the data file. *CUTE*! If I had spent a bunch of time on pre-processing I'd have been annoyed. The SQL Server import widget is happily importing the file as we speak. 179 million records so far after about 18 hours of importing. At this point my biggest problem is that the first line in the file, the field def line, also had quotes around them (comma delimited) and for some reason the wizard removes the quotes in the data but not the field names. Thus I have a table with leading and trailing quotes in every field name which I will have to figure out how to strip out. IIRC I cannot rename fields in SQL Server if there is very much data in the table, and there is just a bit of data in this table - 182 gigs so far. I do have one question. The import wizard uses varchar(50) as the default field size. I had to modify one field (the email field) to longer than that, however many of these fields are just a single character. Is there metadata which SQL Server stores to tell me what the longest actual data in each field is? And if so, is there any advantage to "shrinking" the field size from varchar(50) to char(1) for the hundreds of single character "code" fields or the other fields where the actual data is varchar but shorter - 15 characters or 40 characters? John W. Colby Colby Consulting Reality is what refuses to go away when you do not believe in it On 3/23/2012 4:54 PM, Stuart McLachlan wrote: > I'd just use a text editor with decent regexp find/replace (Crimson Editor?) to convert the list > into a Create Table SQL query. It should only take a couple of minutes. > > Heck, if you want to send me the definition file, I will do a first pass on it for you. > From stuart at lexacorp.com.pg Sat Mar 24 15:10:46 2012 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Sun, 25 Mar 2012 06:10:46 +1000 Subject: [dba-SQLServer] table definition file In-Reply-To: <4F6DC71B.9000808@colbyconsulting.com> References: <4F6CA684.1000406@colbyconsulting.com>, <4F6CE2E8.26257.325AABC1@stuart.lexacorp.com.pg>, <4F6DC71B.9000808@colbyconsulting.com> Message-ID: <4F6E2A46.18988.37597715@stuart.lexacorp.com.pg> There is ne sotrage advantage to shrinking th varchaf() but you will gaind space by making the single character fields to char(1). On 24 Mar 2012 at 9:07, jwcolby wrote: > Thanks for the offer Stuart. > > It turns out that the file was comma delimited CSV with the first line being field defs. I just > imported the file using SQl Server's import wizard. Then it turns out that the table definition > file didn't even remotely match the actual fields in the data file. *CUTE*! If I had spent a bunch > of time on pre-processing I'd have been annoyed. > > The SQL Server import widget is happily importing the file as we speak. 179 million records so far > after about 18 hours of importing. > > At this point my biggest problem is that the first line in the file, the field def line, also had > quotes around them (comma delimited) and for some reason the wizard removes the quotes in the data > but not the field names. Thus I have a table with leading and trailing quotes in every field name > which I will have to figure out how to strip out. IIRC I cannot rename fields in SQL Server if > there is very much data in the table, and there is just a bit of data in this table - 182 gigs so far. > > I do have one question. The import wizard uses varchar(50) as the default field size. I had to > modify one field (the email field) to longer than that, however many of these fields are just a > single character. Is there metadata which SQL Server stores to tell me what the longest actual data > in each field is? And if so, is there any advantage to "shrinking" the field size from varchar(50) > to char(1) for the hundreds of single character "code" fields or the other fields where the actual > data is varchar but shorter - 15 characters or 40 characters? > > John W. Colby > Colby Consulting > > Reality is what refuses to go away > when you do not believe in it > > On 3/23/2012 4:54 PM, Stuart McLachlan wrote: > > I'd just use a text editor with decent regexp find/replace (Crimson Editor?) to convert the list > > into a Create Table SQL query. It should only take a couple of minutes. > > > > Heck, if you want to send me the definition file, I will do a first pass on it for you. > > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From gustav at cactus.dk Sat Mar 24 18:09:37 2012 From: gustav at cactus.dk (Gustav Brock) Date: Sun, 25 Mar 2012 00:09:37 +0100 Subject: [dba-SQLServer] tale defelition filr Message-ID: Hi Stuart Congratulations with your new smartphone! /gustav >>> stuart at lexacorp.com.pg 24-03-12 21:10 >>> There is ne sotrage advantage to shrinking th varchaf() but you will gaind space by making the single character fields to char(1). From stuart at lexacorp.com.pg Sat Mar 24 20:25:30 2012 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Sun, 25 Mar 2012 11:25:30 +1000 Subject: [dba-SQLServer] tale defelition filr In-Reply-To: References: Message-ID: <4F6E740A.425.38797BEB@stuart.lexacorp.com.pg> Sorry about that. I was still half asleep at 6:00am on Sunday morning and typing on my laptop in bed in very poor light :-( -- Stuart On 25 Mar 2012 at 0:09, Gustav Brock wrote: > Hi Stuart > > Congratulations with your new smartphone! > > /gustav > > >>> stuart at lexacorp.com.pg 24-03-12 21:10 >>> > There is ne sotrage advantage to shrinking th varchaf() but you will gaind space by making > the single character fields to char(1). > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From dbdoug at gmail.com Sat Mar 24 21:11:39 2012 From: dbdoug at gmail.com (Doug Steele) Date: Sat, 24 Mar 2012 19:11:39 -0700 Subject: [dba-SQLServer] tale defelition filr In-Reply-To: <4F6E740A.425.38797BEB@stuart.lexacorp.com.pg> References: <4F6E740A.425.38797BEB@stuart.lexacorp.com.pg> Message-ID: And your lady friend kept bumping your elbow..... On Sat, Mar 24, 2012 at 6:25 PM, Stuart McLachlan wrote: > > > Sorry about that. > > I was still half asleep at 6:00am on Sunday morning and typing on my > laptop in bed in very > poor light :-( > > -- > Stuart > > On 25 Mar 2012 at 0:09, Gustav Brock wrote: > > > Hi Stuart > > > > Congratulations with your new smartphone! > > > > /gustav > > > > >>> stuart at lexacorp.com.pg 24-03-12 21:10 >>> > > There is ne sotrage advantage to shrinking th varchaf() but you will > gaind space by making > > the single character fields to char(1). > > > > _______________________________________________ > > dba-SQLServer mailing list > > dba-SQLServer at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > http://www.databaseadvisors.com > > > > > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From stuart at lexacorp.com.pg Sat Mar 24 21:42:11 2012 From: stuart at lexacorp.com.pg (Stuart McLachlan) Date: Sun, 25 Mar 2012 12:42:11 +1000 Subject: [dba-SQLServer] tale defelition filr In-Reply-To: References: , <4F6E740A.425.38797BEB@stuart.lexacorp.com.pg>, Message-ID: <4F6E8603.4230.38D8D2@stuart.lexacorp.com.pg> That would have been Cheryl, our 9yo daughter. Baiya was sitting at the desk beside the bed, checking out Facebook. Cheryl fell asleep last night on our bed while watching TV. When she does that and we all end up sleeping together, she has a habit of sprawling out taking up more than half of the bed and the two of us have an uncomfortable night perched on the edge. Just to make it worse, Cheryl's cat joined us for a while in the middle of the night. When I posted, we were both half awake after a restless night and waiting for the water to boil for her tea and my cofffee. ( I'm never much use before that first caffeine hit) We are now having a very lazy Sunday :-) -- Stuart On 24 Mar 2012 at 19:11, Doug Steele wrote: > And your lady friend kept bumping your elbow..... > > On Sat, Mar 24, 2012 at 6:25 PM, Stuart McLachlan wrote: > > > > > > > Sorry about that. > > > > I was still half asleep at 6:00am on Sunday morning and typing on my > > laptop in bed in very > > poor light :-( > > > > -- > > Stuart > > > > On 25 Mar 2012 at 0:09, Gustav Brock wrote: > > > > > Hi Stuart > > > > > > Congratulations with your new smartphone! > > > > > > /gustav > > > > > > >>> stuart at lexacorp.com.pg 24-03-12 21:10 >>> > > > There is ne sotrage advantage to shrinking th varchaf() but you will > > gaind space by making > > > the single character fields to char(1). > > > > > > _______________________________________________ > > > dba-SQLServer mailing list > > > dba-SQLServer at databaseadvisors.com > > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > > http://www.databaseadvisors.com > > > > > > > > > > > > _______________________________________________ > > dba-SQLServer mailing list > > dba-SQLServer at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > http://www.databaseadvisors.com > > > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From dbdoug at gmail.com Sat Mar 24 23:07:59 2012 From: dbdoug at gmail.com (Doug Steele) Date: Sat, 24 Mar 2012 21:07:59 -0700 Subject: [dba-SQLServer] tale defelition filr In-Reply-To: <4F6E8603.4230.38D8D2@stuart.lexacorp.com.pg> References: <4F6E740A.425.38797BEB@stuart.lexacorp.com.pg> <4F6E8603.4230.38D8D2@stuart.lexacorp.com.pg> Message-ID: Very nice! Doug On Sat, Mar 24, 2012 at 7:42 PM, Stuart McLachlan wrote: > That would have been Cheryl, our 9yo daughter. > > Baiya was sitting at the desk beside the bed, checking out Facebook. > > Cheryl fell asleep last night on our bed while watching TV. When she does > that and we all > end up sleeping together, she has a habit of sprawling out taking up more > than half of the > bed and the two of us have an uncomfortable night perched on the edge. > Just to make it > worse, Cheryl's cat joined us for a while in the middle of the night. > > When I posted, we were both half awake after a restless night and waiting > for the water to > boil for her tea and my cofffee. ( I'm never much use before that first > caffeine hit) > > We are now having a very lazy Sunday :-) > > > -- > Stuart > > On 24 Mar 2012 at 19:11, Doug Steele wrote: > > > And your lady friend kept bumping your elbow..... > > > > On Sat, Mar 24, 2012 at 6:25 PM, Stuart McLachlan < > stuart at lexacorp.com.pg>wrote: > > > > > > > > > > > Sorry about that. > > > > > > I was still half asleep at 6:00am on Sunday morning and typing on my > > > laptop in bed in very > > > poor light :-( > > > > > > -- > > > Stuart > > > > > > On 25 Mar 2012 at 0:09, Gustav Brock wrote: > > > > > > > Hi Stuart > > > > > > > > Congratulations with your new smartphone! > > > > > > > > /gustav > > > > > > > > >>> stuart at lexacorp.com.pg 24-03-12 21:10 >>> > > > > There is ne sotrage advantage to shrinking th varchaf() but you will > > > gaind space by making > > > > the single character fields to char(1). > > > > > > > > _______________________________________________ > > > > dba-SQLServer mailing list > > > > dba-SQLServer at databaseadvisors.com > > > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > > > http://www.databaseadvisors.com > > > > > > > > > > > > > > > > > _______________________________________________ > > > dba-SQLServer mailing list > > > dba-SQLServer at databaseadvisors.com > > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > > http://www.databaseadvisors.com > > > > > > > > _______________________________________________ > > dba-SQLServer mailing list > > dba-SQLServer at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > http://www.databaseadvisors.com > > > > > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From markamatte at hotmail.com Tue Mar 27 15:59:28 2012 From: markamatte at hotmail.com (Mark A Matte) Date: Tue, 27 Mar 2012 20:59:28 +0000 Subject: [dba-SQLServer] SQL vin check sum In-Reply-To: References: , <4F6E740A.425.38797BEB@stuart.lexacorp.com.pg>, , <4F6E8603.4230.38D8D2@stuart.lexacorp.com.pg>, Message-ID: Hello All, Anyone have a SQL based "VIN Check Sum" Function I can borrow to test if a VIN is valid...for United States Vehicle Identification Number? Thanks, Mark A. Matte From davidmcafee at gmail.com Tue Mar 27 16:29:09 2012 From: davidmcafee at gmail.com (David McAfee) Date: Tue, 27 Mar 2012 14:29:09 -0700 Subject: [dba-SQLServer] SQL vin check sum In-Reply-To: References: <4F6E740A.425.38797BEB@stuart.lexacorp.com.pg> <4F6E8603.4230.38D8D2@stuart.lexacorp.com.pg> Message-ID: I don't, but maybe these links can help http://en.wikipedia.org/wiki/Vehicle_Identification_Number http://en.wikibooks.org/wiki/Vehicle_Identification_Numbers_%28VIN_codes%29/Check_digit On Tue, Mar 27, 2012 at 1:59 PM, Mark A Matte wrote: > > Hello All, > > Anyone have a SQL based "VIN Check Sum" Function I can borrow to test if a > VIN is valid...for United States Vehicle Identification Number? > > Thanks, > > Mark A. Matte > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From markamatte at hotmail.com Thu Mar 29 10:31:00 2012 From: markamatte at hotmail.com (Mark A Matte) Date: Thu, 29 Mar 2012 15:31:00 +0000 Subject: [dba-SQLServer] SQL vin check sum In-Reply-To: References: , <4F6E740A.425.38797BEB@stuart.lexacorp.com.pg>, , <4F6E8603.4230.38D8D2@stuart.lexacorp.com.pg>, , , Message-ID: Thanks David, I had looked at those...but I just found a UDF sample online. Worked good. Thanks, mark A. Matte > Date: Tue, 27 Mar 2012 14:29:09 -0700 > From: davidmcafee at gmail.com > To: dba-sqlserver at databaseadvisors.com > Subject: Re: [dba-SQLServer] SQL vin check sum > > I don't, but maybe these links can help > > http://en.wikipedia.org/wiki/Vehicle_Identification_Number > > http://en.wikibooks.org/wiki/Vehicle_Identification_Numbers_%28VIN_codes%29/Check_digit > > > On Tue, Mar 27, 2012 at 1:59 PM, Mark A Matte wrote: > > > > > Hello All, > > > > Anyone have a SQL based "VIN Check Sum" Function I can borrow to test if a > > VIN is valid...for United States Vehicle Identification Number? > > > > Thanks, > > > > Mark A. Matte > > > > _______________________________________________ > > dba-SQLServer mailing list > > dba-SQLServer at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > http://www.databaseadvisors.com > > > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > From davidmcafee at gmail.com Thu Mar 29 10:43:13 2012 From: davidmcafee at gmail.com (David McAfee) Date: Thu, 29 Mar 2012 08:43:13 -0700 Subject: [dba-SQLServer] SQL vin check sum In-Reply-To: References: <4F6E740A.425.38797BEB@stuart.lexacorp.com.pg> <4F6E8603.4230.38D8D2@stuart.lexacorp.com.pg> Message-ID: Care to share? I'd like to see it. On Thu, Mar 29, 2012 at 8:31 AM, Mark A Matte wrote: > > Thanks David, > > I had looked at those...but I just found a UDF sample online. > > Worked good. > > Thanks, > > mark A. Matte > > > > Date: Tue, 27 Mar 2012 14:29:09 -0700 > > From: davidmcafee at gmail.com > > To: dba-sqlserver at databaseadvisors.com > > Subject: Re: [dba-SQLServer] SQL vin check sum > > > > I don't, but maybe these links can help > > > > http://en.wikipedia.org/wiki/Vehicle_Identification_Number > > > > > http://en.wikibooks.org/wiki/Vehicle_Identification_Numbers_%28VIN_codes%29/Check_digit > > > > > > On Tue, Mar 27, 2012 at 1:59 PM, Mark A Matte >wrote: > > > > > > > > Hello All, > > > > > > Anyone have a SQL based "VIN Check Sum" Function I can borrow to test > if a > > > VIN is valid...for United States Vehicle Identification Number? > > > > > > Thanks, > > > > > > Mark A. Matte > > > > > > _______________________________________________ > > > dba-SQLServer mailing list > > > dba-SQLServer at databaseadvisors.com > > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > > http://www.databaseadvisors.com > > > > > > > > _______________________________________________ > > dba-SQLServer mailing list > > dba-SQLServer at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > http://www.databaseadvisors.com > > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com > > From markamatte at hotmail.com Thu Mar 29 12:56:10 2012 From: markamatte at hotmail.com (Mark A Matte) Date: Thu, 29 Mar 2012 17:56:10 +0000 Subject: [dba-SQLServer] SQL vin check sum In-Reply-To: References: , <4F6E740A.425.38797BEB@stuart.lexacorp.com.pg>, , <4F6E8603.4230.38D8D2@stuart.lexacorp.com.pg>, , , , , Message-ID: It was a pain searching for a keyword of sql and vin...but finally stumbled across this: http://www.mombu.com/microsoft/sql-server/t-help-with-t-sql-coding-297549.html I added a modification though...it does NOT handle invalid characters...so it would tell you a vin was good(or bad) after the checksum even though an invalid character was passed. After the : SELECT @value = Value FROM Vin_Digit WHERE Digit = SUBSTRING(@Vin, @position, 1) I added to this check for null meaning the character was NOT valid: IF @value is null SET @MyError = 'X' -- Bad Character Also...you have to populate the 2 tables created with the correct values...if you are already working with vins/checksum...you will know which to populate. Hope it helps... Mark A. Matte > Date: Thu, 29 Mar 2012 08:43:13 -0700 > From: davidmcafee at gmail.com > To: dba-sqlserver at databaseadvisors.com > Subject: Re: [dba-SQLServer] SQL vin check sum > > Care to share? I'd like to see it. > > On Thu, Mar 29, 2012 at 8:31 AM, Mark A Matte wrote: > > > > > Thanks David, > > > > I had looked at those...but I just found a UDF sample online. > > > > Worked good. > > > > Thanks, > > > > mark A. Matte > > > > > > > Date: Tue, 27 Mar 2012 14:29:09 -0700 > > > From: davidmcafee at gmail.com > > > To: dba-sqlserver at databaseadvisors.com > > > Subject: Re: [dba-SQLServer] SQL vin check sum > > > > > > I don't, but maybe these links can help > > > > > > http://en.wikipedia.org/wiki/Vehicle_Identification_Number > > > > > > > > http://en.wikibooks.org/wiki/Vehicle_Identification_Numbers_%28VIN_codes%29/Check_digit > > > > > > > > > On Tue, Mar 27, 2012 at 1:59 PM, Mark A Matte > >wrote: > > > > > > > > > > > Hello All, > > > > > > > > Anyone have a SQL based "VIN Check Sum" Function I can borrow to test > > if a > > > > VIN is valid...for United States Vehicle Identification Number? > > > > > > > > Thanks, > > > > > > > > Mark A. Matte > > > > > > > > _______________________________________________ > > > > dba-SQLServer mailing list > > > > dba-SQLServer at databaseadvisors.com > > > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > > > http://www.databaseadvisors.com > > > > > > > > > > > _______________________________________________ > > > dba-SQLServer mailing list > > > dba-SQLServer at databaseadvisors.com > > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > > http://www.databaseadvisors.com > > > > > > > _______________________________________________ > > dba-SQLServer mailing list > > dba-SQLServer at databaseadvisors.com > > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > > http://www.databaseadvisors.com > > > > > _______________________________________________ > dba-SQLServer mailing list > dba-SQLServer at databaseadvisors.com > http://databaseadvisors.com/mailman/listinfo/dba-sqlserver > http://www.databaseadvisors.com >