Hi I need to create a stored procedure that can do the following but now sure
if it can be done with sql2000.
1. read in existing data from a table.
2. create the current Julian date.
3. make a comparison and add a sequence number onto this number if it is a
specific Julian date.
I think all of this could probably be done with 2005 since it allows using
C#,vb for TSQL.
Paul G
Software engineer.On Wed, 30 Aug 2006 08:18:02 -0700, Paul
<Paul@.discussions.microsoft.com> wrote:
>Hi I need to create a stored procedure that can do the following but now sure
>if it can be done with sql2000.
>1. read in existing data from a table.
Stored procedures are very good at retrieving data from database
tables.
>2. create the current Julian date.
SQL Server has sufficient tools for date manipulation that calculating
Julian date from the current date (getdate()) should be no problem. It
does, however, require knowing which definition of Julian date is
intended.
>3. make a comparison and add a sequence number onto this number if it is a
>specific Julian date.
Comparison of what to what? By "this number" do you mean the Julian
data calculated in item 2? What specific Julian date? One passed as
a parameter to the stored procedure? One retrieved from the table in
item 1?
>I think all of this could probably be done with 2005 since it allows using
>C#,vb for TSQL.
I am sure it can be done in 2005. It is unclear from the information
give that it will require C# or VB, but if it turns out to be
complicated they are available. Perhaps if you provided a bit more
detail someone will be able to suggest an appropriate approach.
>Paul G
>Software engineer.
Roy Harvey
Beacon Falls, CT|||Hi thanks for the response. Here are more details on what I am trying to do.
There is a table (table1) that has hundreds of records that look like
JTB-ABC-MDTC-06200-0001
JCV-BCD-ABAM-06201-0001
JTB-ABC-MDAC-06200-0002
I need the stored procedure to take the value
JCV-BCD-RBSV
and build the rest of it based on the following conditions and then save it
to a table.
Get the current julian date, today would be 06242, two hundred forty two day
of year 06. The value we are building would then look like JVC-BCD-RBSV-06242
and only the last section still to be built. This is done by doing the
following.
1. Compare the jul date for the day the stored procedure will run (06242)
and find all records in table 1 with the same date (call this subset a).
2. Next out of subset a find all that match the first 6 letters (create
subset b).
3. Next out of subset b find the greatest value of the last 4 numbers (say
it was 0002).
4. Finally increment this value by 1 and use it to finish the newly created
value, so we would have JVC-BCD-RBSV-06242-0003.
This is easy to do in vb or C#.
--
Paul G
Software engineer.
"Roy Harvey" wrote:
> On Wed, 30 Aug 2006 08:18:02 -0700, Paul
> <Paul@.discussions.microsoft.com> wrote:
> >Hi I need to create a stored procedure that can do the following but now sure
> >if it can be done with sql2000.
> >
> >1. read in existing data from a table.
> Stored procedures are very good at retrieving data from database
> tables.
> >2. create the current Julian date.
> SQL Server has sufficient tools for date manipulation that calculating
> Julian date from the current date (getdate()) should be no problem. It
> does, however, require knowing which definition of Julian date is
> intended.
> >3. make a comparison and add a sequence number onto this number if it is a
> >specific Julian date.
> Comparison of what to what? By "this number" do you mean the Julian
> data calculated in item 2? What specific Julian date? One passed as
> a parameter to the stored procedure? One retrieved from the table in
> item 1?
> >I think all of this could probably be done with 2005 since it allows using
> >C#,vb for TSQL.
> I am sure it can be done in 2005. It is unclear from the information
> give that it will require C# or VB, but if it turns out to be
> complicated they are available. Perhaps if you provided a bit more
> detail someone will be able to suggest an appropriate approach.
> >Paul G
> >Software engineer.
> Roy Harvey
> Beacon Falls, CT
>|||Of course all the parts of that complex column should be individual
table columns, but I will not belabor that point.
There is nothing about that which requires going to C# or VB. This
should give you some ideas. Note that I used a view, but each of the
pieces could have been substringed out when references. However since
all the real work is one in one SQL command, all those references
would make it a good bit more opaque. Another advantage to the view
is that it is possible to make it an indexed view, which could make a
major difference in performance.
CREATE TABLE Table1
(StrungOut char(23) NOT NULL)
INSERT Table1 values ('JTB-ABC-MDTC-06200-0001')
INSERT Table1 values ('JCV-BCD-ABAM-06201-0001')
INSERT Table1 values ('JTB-ABC-MDAC-06200-0002')
INSERT Table1 values ('JCV-BCD-ABAM-06242-0005')
GO
CREATE VIEW Table1_V
AS
SELECT StrungOut,
First6 = SUBSTRING(StrungOut,1,6),
JDate = SUBSTRING(StrungOut,14,5),
JYear = SUBSTRING(StrungOut,14,2),
JDay = SUBSTRING(StrungOut,16,3),
Last4 = SUBSTRING(Strungout,20,4)
FROM Table1
GO
CREATE TABLE Table2
(StrungOut char(23) NOT NULL)
GO
CREATE PROC Demonstration
@.front char(12)
AS
INSERT Table2
SELECT @.front + '-' +
right(convert(char(4),datepart(year,getdate())),2) +
right(convert(char(4),datepart(dayofyear,getdate())+1000),3) +
'-' +
RIGHT(convert(char(5),(convert(int,MAX(Last4)) + 1) + 10000),4)
FROM Table1_V
WHERE JDate = right(convert(char(4),datepart(year,getdate())),2) +
right(convert(char(4),datepart(dayofyear,getdate())+1000),3)
AND First6 = SUBSTRING(@.front,1,6)
GO
EXEC Demonstration 'JCV-BCD-RBSV'
SELECT *
FROM Table2
StrungOut
--
JCV-BCD-RBSV-06242-0006
Also, in the spec you mentioned matching on the first six characters,
but I wondered if it might have actually been the first seven.
One final point worth making. It would be quite practical to modify
this so that rather than taking in a string as a parameter, it
produced a new row such as this for each Front6 in Table1 that matches
the current date.
Roy Harvey
Beacon Falls, CT
On Wed, 30 Aug 2006 09:09:02 -0700, Paul
<Paul@.discussions.microsoft.com> wrote:
>Hi thanks for the response. Here are more details on what I am trying to do.
>There is a table (table1) that has hundreds of records that look like
>JTB-ABC-MDTC-06200-0001
>JCV-BCD-ABAM-06201-0001
>JTB-ABC-MDAC-06200-0002
>I need the stored procedure to take the value
>JCV-BCD-RBSV
>and build the rest of it based on the following conditions and then save it
>to a table.
>Get the current julian date, today would be 06242, two hundred forty two day
>of year 06. The value we are building would then look like JVC-BCD-RBSV-06242
>and only the last section still to be built. This is done by doing the
>following.
>1. Compare the jul date for the day the stored procedure will run (06242)
>and find all records in table 1 with the same date (call this subset a).
>2. Next out of subset a find all that match the first 6 letters (create
>subset b).
>3. Next out of subset b find the greatest value of the last 4 numbers (say
>it was 0002).
>4. Finally increment this value by 1 and use it to finish the newly created
>value, so we would have JVC-BCD-RBSV-06242-0003.
>This is easy to do in vb or C#.|||An alternate coding of the WHERE clause:
WHERE JYear = right(convert(char(4),datepart(year,getdate())),2)
AND JDay = right(convert(char(4),datepart(dayofyear,getdate())+1000),3)
AND First6 = SUBSTRING(@.front,1,6)
Roy
On Wed, 30 Aug 2006 13:00:08 -0400, Roy Harvey <roy_harvey@.snet.net>
wrote:
>Of course all the parts of that complex column should be individual
>table columns, but I will not belabor that point.
>There is nothing about that which requires going to C# or VB. This
>should give you some ideas. Note that I used a view, but each of the
>pieces could have been substringed out when references. However since
>all the real work is one in one SQL command, all those references
>would make it a good bit more opaque. Another advantage to the view
>is that it is possible to make it an indexed view, which could make a
>major difference in performance.
>CREATE TABLE Table1
>(StrungOut char(23) NOT NULL)
>INSERT Table1 values ('JTB-ABC-MDTC-06200-0001')
>INSERT Table1 values ('JCV-BCD-ABAM-06201-0001')
>INSERT Table1 values ('JTB-ABC-MDAC-06200-0002')
>INSERT Table1 values ('JCV-BCD-ABAM-06242-0005')
>GO
>CREATE VIEW Table1_V
>AS
>SELECT StrungOut,
> First6 = SUBSTRING(StrungOut,1,6),
> JDate = SUBSTRING(StrungOut,14,5),
> JYear = SUBSTRING(StrungOut,14,2),
> JDay = SUBSTRING(StrungOut,16,3),
> Last4 = SUBSTRING(Strungout,20,4)
> FROM Table1
>GO
>CREATE TABLE Table2
>(StrungOut char(23) NOT NULL)
>GO
>CREATE PROC Demonstration
>@.front char(12)
>AS
>INSERT Table2
>SELECT @.front + '-' +
> right(convert(char(4),datepart(year,getdate())),2) +
> right(convert(char(4),datepart(dayofyear,getdate())+1000),3) +
> '-' +
> RIGHT(convert(char(5),(convert(int,MAX(Last4)) + 1) + 10000),4)
> FROM Table1_V
> WHERE JDate => right(convert(char(4),datepart(year,getdate())),2) +
> right(convert(char(4),datepart(dayofyear,getdate())+1000),3)
> AND First6 = SUBSTRING(@.front,1,6)
>GO
>EXEC Demonstration 'JCV-BCD-RBSV'
>SELECT *
> FROM Table2
>StrungOut
>--
>JCV-BCD-RBSV-06242-0006
>Also, in the spec you mentioned matching on the first six characters,
>but I wondered if it might have actually been the first seven.
>One final point worth making. It would be quite practical to modify
>this so that rather than taking in a string as a parameter, it
>produced a new row such as this for each Front6 in Table1 that matches
>the current date.
>Roy Harvey
>Beacon Falls, CT
>On Wed, 30 Aug 2006 09:09:02 -0700, Paul
><Paul@.discussions.microsoft.com> wrote:
>>Hi thanks for the response. Here are more details on what I am trying to do.
>>There is a table (table1) that has hundreds of records that look like
>>JTB-ABC-MDTC-06200-0001
>>JCV-BCD-ABAM-06201-0001
>>JTB-ABC-MDAC-06200-0002
>>I need the stored procedure to take the value
>>JCV-BCD-RBSV
>>and build the rest of it based on the following conditions and then save it
>>to a table.
>>Get the current julian date, today would be 06242, two hundred forty two day
>>of year 06. The value we are building would then look like JVC-BCD-RBSV-06242
>>and only the last section still to be built. This is done by doing the
>>following.
>>1. Compare the jul date for the day the stored procedure will run (06242)
>>and find all records in table 1 with the same date (call this subset a).
>>2. Next out of subset a find all that match the first 6 letters (create
>>subset b).
>>3. Next out of subset b find the greatest value of the last 4 numbers (say
>>it was 0002).
>>4. Finally increment this value by 1 and use it to finish the newly created
>>value, so we would have JVC-BCD-RBSV-06242-0003.
>>This is easy to do in vb or C#.|||Hi thanks for the response. Yes the table was already setup and there was
not time to restructure. Will take a look at what you have. Was not aware
that you can do a lot with SQL.
--
Paul G
Software engineer.
"Roy Harvey" wrote:
> Of course all the parts of that complex column should be individual
> table columns, but I will not belabor that point.
> There is nothing about that which requires going to C# or VB. This
> should give you some ideas. Note that I used a view, but each of the
> pieces could have been substringed out when references. However since
> all the real work is one in one SQL command, all those references
> would make it a good bit more opaque. Another advantage to the view
> is that it is possible to make it an indexed view, which could make a
> major difference in performance.
> CREATE TABLE Table1
> (StrungOut char(23) NOT NULL)
> INSERT Table1 values ('JTB-ABC-MDTC-06200-0001')
> INSERT Table1 values ('JCV-BCD-ABAM-06201-0001')
> INSERT Table1 values ('JTB-ABC-MDAC-06200-0002')
> INSERT Table1 values ('JCV-BCD-ABAM-06242-0005')
> GO
> CREATE VIEW Table1_V
> AS
> SELECT StrungOut,
> First6 = SUBSTRING(StrungOut,1,6),
> JDate = SUBSTRING(StrungOut,14,5),
> JYear = SUBSTRING(StrungOut,14,2),
> JDay = SUBSTRING(StrungOut,16,3),
> Last4 = SUBSTRING(Strungout,20,4)
> FROM Table1
> GO
> CREATE TABLE Table2
> (StrungOut char(23) NOT NULL)
> GO
> CREATE PROC Demonstration
> @.front char(12)
> AS
> INSERT Table2
> SELECT @.front + '-' +
> right(convert(char(4),datepart(year,getdate())),2) +
> right(convert(char(4),datepart(dayofyear,getdate())+1000),3) +
> '-' +
> RIGHT(convert(char(5),(convert(int,MAX(Last4)) + 1) + 10000),4)
> FROM Table1_V
> WHERE JDate => right(convert(char(4),datepart(year,getdate())),2) +
> right(convert(char(4),datepart(dayofyear,getdate())+1000),3)
> AND First6 = SUBSTRING(@.front,1,6)
> GO
> EXEC Demonstration 'JCV-BCD-RBSV'
> SELECT *
> FROM Table2
> StrungOut
> --
> JCV-BCD-RBSV-06242-0006
> Also, in the spec you mentioned matching on the first six characters,
> but I wondered if it might have actually been the first seven.
> One final point worth making. It would be quite practical to modify
> this so that rather than taking in a string as a parameter, it
> produced a new row such as this for each Front6 in Table1 that matches
> the current date.
> Roy Harvey
> Beacon Falls, CT
> On Wed, 30 Aug 2006 09:09:02 -0700, Paul
> <Paul@.discussions.microsoft.com> wrote:
> >Hi thanks for the response. Here are more details on what I am trying to do.
> >There is a table (table1) that has hundreds of records that look like
> >JTB-ABC-MDTC-06200-0001
> >JCV-BCD-ABAM-06201-0001
> >JTB-ABC-MDAC-06200-0002
> >
> >I need the stored procedure to take the value
> >JCV-BCD-RBSV
> >and build the rest of it based on the following conditions and then save it
> >to a table.
> >Get the current julian date, today would be 06242, two hundred forty two day
> >of year 06. The value we are building would then look like JVC-BCD-RBSV-06242
> >and only the last section still to be built. This is done by doing the
> >following.
> >1. Compare the jul date for the day the stored procedure will run (06242)
> >and find all records in table 1 with the same date (call this subset a).
> >2. Next out of subset a find all that match the first 6 letters (create
> >subset b).
> >3. Next out of subset b find the greatest value of the last 4 numbers (say
> >it was 0002).
> >4. Finally increment this value by 1 and use it to finish the newly created
> >value, so we would have JVC-BCD-RBSV-06242-0003.
> >This is easy to do in vb or C#.
>|||I see were you get the current julian date, JYear and JDay but I did not see
if combine these to get the 06242 for example for today. thanks.
Paul G
Software engineer.
"Roy Harvey" wrote:
> An alternate coding of the WHERE clause:
> WHERE JYear => right(convert(char(4),datepart(year,getdate())),2)
> AND JDay => right(convert(char(4),datepart(dayofyear,getdate())+1000),3)
> AND First6 = SUBSTRING(@.front,1,6)
> Roy
> On Wed, 30 Aug 2006 13:00:08 -0400, Roy Harvey <roy_harvey@.snet.net>
> wrote:
> >Of course all the parts of that complex column should be individual
> >table columns, but I will not belabor that point.
> >
> >There is nothing about that which requires going to C# or VB. This
> >should give you some ideas. Note that I used a view, but each of the
> >pieces could have been substringed out when references. However since
> >all the real work is one in one SQL command, all those references
> >would make it a good bit more opaque. Another advantage to the view
> >is that it is possible to make it an indexed view, which could make a
> >major difference in performance.
> >
> >CREATE TABLE Table1
> >(StrungOut char(23) NOT NULL)
> >
> >INSERT Table1 values ('JTB-ABC-MDTC-06200-0001')
> >INSERT Table1 values ('JCV-BCD-ABAM-06201-0001')
> >INSERT Table1 values ('JTB-ABC-MDAC-06200-0002')
> >INSERT Table1 values ('JCV-BCD-ABAM-06242-0005')
> >
> >GO
> >CREATE VIEW Table1_V
> >AS
> >SELECT StrungOut,
> > First6 = SUBSTRING(StrungOut,1,6),
> > JDate = SUBSTRING(StrungOut,14,5),
> > JYear = SUBSTRING(StrungOut,14,2),
> > JDay = SUBSTRING(StrungOut,16,3),
> > Last4 = SUBSTRING(Strungout,20,4)
> > FROM Table1
> >GO
> >
> >CREATE TABLE Table2
> >(StrungOut char(23) NOT NULL)
> >GO
> >
> >CREATE PROC Demonstration
> >@.front char(12)
> >AS
> >
> >INSERT Table2
> >SELECT @.front + '-' +
> > right(convert(char(4),datepart(year,getdate())),2) +
> > right(convert(char(4),datepart(dayofyear,getdate())+1000),3) +
> > '-' +
> > RIGHT(convert(char(5),(convert(int,MAX(Last4)) + 1) + 10000),4)
> > FROM Table1_V
> > WHERE JDate => > right(convert(char(4),datepart(year,getdate())),2) +
> > right(convert(char(4),datepart(dayofyear,getdate())+1000),3)
> > AND First6 = SUBSTRING(@.front,1,6)
> >GO
> >
> >EXEC Demonstration 'JCV-BCD-RBSV'
> >
> >SELECT *
> > FROM Table2
> >
> >StrungOut
> >--
> >JCV-BCD-RBSV-06242-0006
> >
> >Also, in the spec you mentioned matching on the first six characters,
> >but I wondered if it might have actually been the first seven.
> >
> >One final point worth making. It would be quite practical to modify
> >this so that rather than taking in a string as a parameter, it
> >produced a new row such as this for each Front6 in Table1 that matches
> >the current date.
> >
> >Roy Harvey
> >Beacon Falls, CT
> >
> >On Wed, 30 Aug 2006 09:09:02 -0700, Paul
> ><Paul@.discussions.microsoft.com> wrote:
> >
> >>Hi thanks for the response. Here are more details on what I am trying to do.
> >>There is a table (table1) that has hundreds of records that look like
> >>JTB-ABC-MDTC-06200-0001
> >>JCV-BCD-ABAM-06201-0001
> >>JTB-ABC-MDAC-06200-0002
> >>
> >>I need the stored procedure to take the value
> >>JCV-BCD-RBSV
> >>and build the rest of it based on the following conditions and then save it
> >>to a table.
> >>Get the current julian date, today would be 06242, two hundred forty two day
> >>of year 06. The value we are building would then look like JVC-BCD-RBSV-06242
> >>and only the last section still to be built. This is done by doing the
> >>following.
> >>1. Compare the jul date for the day the stored procedure will run (06242)
> >>and find all records in table 1 with the same date (call this subset a).
> >>2. Next out of subset a find all that match the first 6 letters (create
> >>subset b).
> >>3. Next out of subset b find the greatest value of the last 4 numbers (say
> >>it was 0002).
> >>4. Finally increment this value by 1 and use it to finish the newly created
> >>value, so we would have JVC-BCD-RBSV-06242-0003.
> >>This is easy to do in vb or C#.
>|||JYear and JDay are the pieces of the Julian date in Table1, so they
are only used for the comparison.
In the assignment:
SELECT @.front + '-' +
right(convert(char(4),datepart(year,getdate())),2) +
right(convert(char(4),datepart(dayofyear,getdate())+1000),3) +
'-' +
RIGHT(convert(char(5),(convert(int,MAX(Last4)) + 1) + 10000),4)
the Julian date part of the output string is the second and third
lines. BUT, I just thought of an alternate way to code the
assignment. We went to all that trouble to make sure Table1_V.JDate
matched the current day, so instead of using the current day we could
just use Table1_V.JDate.
SELECT @.front + '-' +
JDate +
'-' +
RIGHT(convert(char(5),(convert(int,MAX(Last4)) + 1) + 10000),4)
However, I'm guessing that IF there is no matching row with the
current date you might actually want to create the new row with 0000
or 0001 as the final part of the string. In that case I would keep to
using the derivation from getdate() as it will be easier to code in
the row-not-found branch.
Roy Harvey
Beacon Falls, CT
On Wed, 30 Aug 2006 10:32:01 -0700, Paul
<Paul@.discussions.microsoft.com> wrote:
>I see were you get the current julian date, JYear and JDay but I did not see
>if combine these to get the 06242 for example for today. thanks.
>Paul G
>Software engineer.
>
>"Roy Harvey" wrote:
>> An alternate coding of the WHERE clause:
>> WHERE JYear =>> right(convert(char(4),datepart(year,getdate())),2)
>> AND JDay =>> right(convert(char(4),datepart(dayofyear,getdate())+1000),3)
>> AND First6 = SUBSTRING(@.front,1,6)
>> Roy
>> On Wed, 30 Aug 2006 13:00:08 -0400, Roy Harvey <roy_harvey@.snet.net>
>> wrote:
>> >Of course all the parts of that complex column should be individual
>> >table columns, but I will not belabor that point.
>> >
>> >There is nothing about that which requires going to C# or VB. This
>> >should give you some ideas. Note that I used a view, but each of the
>> >pieces could have been substringed out when references. However since
>> >all the real work is one in one SQL command, all those references
>> >would make it a good bit more opaque. Another advantage to the view
>> >is that it is possible to make it an indexed view, which could make a
>> >major difference in performance.
>> >
>> >CREATE TABLE Table1
>> >(StrungOut char(23) NOT NULL)
>> >
>> >INSERT Table1 values ('JTB-ABC-MDTC-06200-0001')
>> >INSERT Table1 values ('JCV-BCD-ABAM-06201-0001')
>> >INSERT Table1 values ('JTB-ABC-MDAC-06200-0002')
>> >INSERT Table1 values ('JCV-BCD-ABAM-06242-0005')
>> >
>> >GO
>> >CREATE VIEW Table1_V
>> >AS
>> >SELECT StrungOut,
>> > First6 = SUBSTRING(StrungOut,1,6),
>> > JDate = SUBSTRING(StrungOut,14,5),
>> > JYear = SUBSTRING(StrungOut,14,2),
>> > JDay = SUBSTRING(StrungOut,16,3),
>> > Last4 = SUBSTRING(Strungout,20,4)
>> > FROM Table1
>> >GO
>> >
>> >CREATE TABLE Table2
>> >(StrungOut char(23) NOT NULL)
>> >GO
>> >
>> >CREATE PROC Demonstration
>> >@.front char(12)
>> >AS
>> >
>> >INSERT Table2
>> >SELECT @.front + '-' +
>> > right(convert(char(4),datepart(year,getdate())),2) +
>> > right(convert(char(4),datepart(dayofyear,getdate())+1000),3) +
>> > '-' +
>> > RIGHT(convert(char(5),(convert(int,MAX(Last4)) + 1) + 10000),4)
>> > FROM Table1_V
>> > WHERE JDate =>> > right(convert(char(4),datepart(year,getdate())),2) +
>> > right(convert(char(4),datepart(dayofyear,getdate())+1000),3)
>> > AND First6 = SUBSTRING(@.front,1,6)
>> >GO
>> >
>> >EXEC Demonstration 'JCV-BCD-RBSV'
>> >
>> >SELECT *
>> > FROM Table2
>> >
>> >StrungOut
>> >--
>> >JCV-BCD-RBSV-06242-0006
>> >
>> >Also, in the spec you mentioned matching on the first six characters,
>> >but I wondered if it might have actually been the first seven.
>> >
>> >One final point worth making. It would be quite practical to modify
>> >this so that rather than taking in a string as a parameter, it
>> >produced a new row such as this for each Front6 in Table1 that matches
>> >the current date.
>> >
>> >Roy Harvey
>> >Beacon Falls, CT
>> >
>> >On Wed, 30 Aug 2006 09:09:02 -0700, Paul
>> ><Paul@.discussions.microsoft.com> wrote:
>> >
>> >>Hi thanks for the response. Here are more details on what I am trying to do.
>> >>There is a table (table1) that has hundreds of records that look like
>> >>JTB-ABC-MDTC-06200-0001
>> >>JCV-BCD-ABAM-06201-0001
>> >>JTB-ABC-MDAC-06200-0002
>> >>
>> >>I need the stored procedure to take the value
>> >>JCV-BCD-RBSV
>> >>and build the rest of it based on the following conditions and then save it
>> >>to a table.
>> >>Get the current julian date, today would be 06242, two hundred forty two day
>> >>of year 06. The value we are building would then look like JVC-BCD-RBSV-06242
>> >>and only the last section still to be built. This is done by doing the
>> >>following.
>> >>1. Compare the jul date for the day the stored procedure will run (06242)
>> >>and find all records in table 1 with the same date (call this subset a).
>> >>2. Next out of subset a find all that match the first 6 letters (create
>> >>subset b).
>> >>3. Next out of subset b find the greatest value of the last 4 numbers (say
>> >>it was 0002).
>> >>4. Finally increment this value by 1 and use it to finish the newly created
>> >>value, so we would have JVC-BCD-RBSV-06242-0003.
>> >>This is easy to do in vb or C#.|||ok thanks for the information.
--
Paul G
Software engineer.
"Roy Harvey" wrote:
> JYear and JDay are the pieces of the Julian date in Table1, so they
> are only used for the comparison.
> In the assignment:
> SELECT @.front + '-' +
> right(convert(char(4),datepart(year,getdate())),2) +
> right(convert(char(4),datepart(dayofyear,getdate())+1000),3) +
> '-' +
> RIGHT(convert(char(5),(convert(int,MAX(Last4)) + 1) + 10000),4)
> the Julian date part of the output string is the second and third
> lines. BUT, I just thought of an alternate way to code the
> assignment. We went to all that trouble to make sure Table1_V.JDate
> matched the current day, so instead of using the current day we could
> just use Table1_V.JDate.
> SELECT @.front + '-' +
> JDate +
> '-' +
> RIGHT(convert(char(5),(convert(int,MAX(Last4)) + 1) + 10000),4)
> However, I'm guessing that IF there is no matching row with the
> current date you might actually want to create the new row with 0000
> or 0001 as the final part of the string. In that case I would keep to
> using the derivation from getdate() as it will be easier to code in
> the row-not-found branch.
> Roy Harvey
> Beacon Falls, CT
> On Wed, 30 Aug 2006 10:32:01 -0700, Paul
> <Paul@.discussions.microsoft.com> wrote:
> >I see were you get the current julian date, JYear and JDay but I did not see
> >if combine these to get the 06242 for example for today. thanks.
> >Paul G
> >Software engineer.
> >
> >
> >"Roy Harvey" wrote:
> >
> >> An alternate coding of the WHERE clause:
> >>
> >> WHERE JYear => >> right(convert(char(4),datepart(year,getdate())),2)
> >> AND JDay => >> right(convert(char(4),datepart(dayofyear,getdate())+1000),3)
> >> AND First6 = SUBSTRING(@.front,1,6)
> >>
> >> Roy
> >>
> >> On Wed, 30 Aug 2006 13:00:08 -0400, Roy Harvey <roy_harvey@.snet.net>
> >> wrote:
> >>
> >> >Of course all the parts of that complex column should be individual
> >> >table columns, but I will not belabor that point.
> >> >
> >> >There is nothing about that which requires going to C# or VB. This
> >> >should give you some ideas. Note that I used a view, but each of the
> >> >pieces could have been substringed out when references. However since
> >> >all the real work is one in one SQL command, all those references
> >> >would make it a good bit more opaque. Another advantage to the view
> >> >is that it is possible to make it an indexed view, which could make a
> >> >major difference in performance.
> >> >
> >> >CREATE TABLE Table1
> >> >(StrungOut char(23) NOT NULL)
> >> >
> >> >INSERT Table1 values ('JTB-ABC-MDTC-06200-0001')
> >> >INSERT Table1 values ('JCV-BCD-ABAM-06201-0001')
> >> >INSERT Table1 values ('JTB-ABC-MDAC-06200-0002')
> >> >INSERT Table1 values ('JCV-BCD-ABAM-06242-0005')
> >> >
> >> >GO
> >> >CREATE VIEW Table1_V
> >> >AS
> >> >SELECT StrungOut,
> >> > First6 = SUBSTRING(StrungOut,1,6),
> >> > JDate = SUBSTRING(StrungOut,14,5),
> >> > JYear = SUBSTRING(StrungOut,14,2),
> >> > JDay = SUBSTRING(StrungOut,16,3),
> >> > Last4 = SUBSTRING(Strungout,20,4)
> >> > FROM Table1
> >> >GO
> >> >
> >> >CREATE TABLE Table2
> >> >(StrungOut char(23) NOT NULL)
> >> >GO
> >> >
> >> >CREATE PROC Demonstration
> >> >@.front char(12)
> >> >AS
> >> >
> >> >INSERT Table2
> >> >SELECT @.front + '-' +
> >> > right(convert(char(4),datepart(year,getdate())),2) +
> >> > right(convert(char(4),datepart(dayofyear,getdate())+1000),3) +
> >> > '-' +
> >> > RIGHT(convert(char(5),(convert(int,MAX(Last4)) + 1) + 10000),4)
> >> > FROM Table1_V
> >> > WHERE JDate => >> > right(convert(char(4),datepart(year,getdate())),2) +
> >> > right(convert(char(4),datepart(dayofyear,getdate())+1000),3)
> >> > AND First6 = SUBSTRING(@.front,1,6)
> >> >GO
> >> >
> >> >EXEC Demonstration 'JCV-BCD-RBSV'
> >> >
> >> >SELECT *
> >> > FROM Table2
> >> >
> >> >StrungOut
> >> >--
> >> >JCV-BCD-RBSV-06242-0006
> >> >
> >> >Also, in the spec you mentioned matching on the first six characters,
> >> >but I wondered if it might have actually been the first seven.
> >> >
> >> >One final point worth making. It would be quite practical to modify
> >> >this so that rather than taking in a string as a parameter, it
> >> >produced a new row such as this for each Front6 in Table1 that matches
> >> >the current date.
> >> >
> >> >Roy Harvey
> >> >Beacon Falls, CT
> >> >
> >> >On Wed, 30 Aug 2006 09:09:02 -0700, Paul
> >> ><Paul@.discussions.microsoft.com> wrote:
> >> >
> >> >>Hi thanks for the response. Here are more details on what I am trying to do.
> >> >>There is a table (table1) that has hundreds of records that look like
> >> >>JTB-ABC-MDTC-06200-0001
> >> >>JCV-BCD-ABAM-06201-0001
> >> >>JTB-ABC-MDAC-06200-0002
> >> >>
> >> >>I need the stored procedure to take the value
> >> >>JCV-BCD-RBSV
> >> >>and build the rest of it based on the following conditions and then save it
> >> >>to a table.
> >> >>Get the current julian date, today would be 06242, two hundred forty two day
> >> >>of year 06. The value we are building would then look like JVC-BCD-RBSV-06242
> >> >>and only the last section still to be built. This is done by doing the
> >> >>following.
> >> >>1. Compare the jul date for the day the stored procedure will run (06242)
> >> >>and find all records in table 1 with the same date (call this subset a).
> >> >>2. Next out of subset a find all that match the first 6 letters (create
> >> >>subset b).
> >> >>3. Next out of subset b find the greatest value of the last 4 numbers (say
> >> >>it was 0002).
> >> >>4. Finally increment this value by 1 and use it to finish the newly created
> >> >>value, so we would have JVC-BCD-RBSV-06242-0003.
> >> >>This is easy to do in vb or C#.
> >>
>|||I tried out the sample and it worked. Anyhow just had a quick last question.
Do you know if there is a way to conditionally run a job? I am thinking of
scheduling the stored procedure but in some cases if a manual data entry has
taken place (through an asp.net web application) I will not want to add a new
record with the scheduled job. I guess this could be properly handled in the
stored procedure(scheduled job), possibly perform some type of table check to
see when the last entry took place to know weather or not to add a record.
Thanks.
--
Paul G
Software engineer.
"Roy Harvey" wrote:
> JYear and JDay are the pieces of the Julian date in Table1, so they
> are only used for the comparison.
> In the assignment:
> SELECT @.front + '-' +
> right(convert(char(4),datepart(year,getdate())),2) +
> right(convert(char(4),datepart(dayofyear,getdate())+1000),3) +
> '-' +
> RIGHT(convert(char(5),(convert(int,MAX(Last4)) + 1) + 10000),4)
> the Julian date part of the output string is the second and third
> lines. BUT, I just thought of an alternate way to code the
> assignment. We went to all that trouble to make sure Table1_V.JDate
> matched the current day, so instead of using the current day we could
> just use Table1_V.JDate.
> SELECT @.front + '-' +
> JDate +
> '-' +
> RIGHT(convert(char(5),(convert(int,MAX(Last4)) + 1) + 10000),4)
> However, I'm guessing that IF there is no matching row with the
> current date you might actually want to create the new row with 0000
> or 0001 as the final part of the string. In that case I would keep to
> using the derivation from getdate() as it will be easier to code in
> the row-not-found branch.
> Roy Harvey
> Beacon Falls, CT
> On Wed, 30 Aug 2006 10:32:01 -0700, Paul
> <Paul@.discussions.microsoft.com> wrote:
> >I see were you get the current julian date, JYear and JDay but I did not see
> >if combine these to get the 06242 for example for today. thanks.
> >Paul G
> >Software engineer.
> >
> >
> >"Roy Harvey" wrote:
> >
> >> An alternate coding of the WHERE clause:
> >>
> >> WHERE JYear => >> right(convert(char(4),datepart(year,getdate())),2)
> >> AND JDay => >> right(convert(char(4),datepart(dayofyear,getdate())+1000),3)
> >> AND First6 = SUBSTRING(@.front,1,6)
> >>
> >> Roy
> >>
> >> On Wed, 30 Aug 2006 13:00:08 -0400, Roy Harvey <roy_harvey@.snet.net>
> >> wrote:
> >>
> >> >Of course all the parts of that complex column should be individual
> >> >table columns, but I will not belabor that point.
> >> >
> >> >There is nothing about that which requires going to C# or VB. This
> >> >should give you some ideas. Note that I used a view, but each of the
> >> >pieces could have been substringed out when references. However since
> >> >all the real work is one in one SQL command, all those references
> >> >would make it a good bit more opaque. Another advantage to the view
> >> >is that it is possible to make it an indexed view, which could make a
> >> >major difference in performance.
> >> >
> >> >CREATE TABLE Table1
> >> >(StrungOut char(23) NOT NULL)
> >> >
> >> >INSERT Table1 values ('JTB-ABC-MDTC-06200-0001')
> >> >INSERT Table1 values ('JCV-BCD-ABAM-06201-0001')
> >> >INSERT Table1 values ('JTB-ABC-MDAC-06200-0002')
> >> >INSERT Table1 values ('JCV-BCD-ABAM-06242-0005')
> >> >
> >> >GO
> >> >CREATE VIEW Table1_V
> >> >AS
> >> >SELECT StrungOut,
> >> > First6 = SUBSTRING(StrungOut,1,6),
> >> > JDate = SUBSTRING(StrungOut,14,5),
> >> > JYear = SUBSTRING(StrungOut,14,2),
> >> > JDay = SUBSTRING(StrungOut,16,3),
> >> > Last4 = SUBSTRING(Strungout,20,4)
> >> > FROM Table1
> >> >GO
> >> >
> >> >CREATE TABLE Table2
> >> >(StrungOut char(23) NOT NULL)
> >> >GO
> >> >
> >> >CREATE PROC Demonstration
> >> >@.front char(12)
> >> >AS
> >> >
> >> >INSERT Table2
> >> >SELECT @.front + '-' +
> >> > right(convert(char(4),datepart(year,getdate())),2) +
> >> > right(convert(char(4),datepart(dayofyear,getdate())+1000),3) +
> >> > '-' +
> >> > RIGHT(convert(char(5),(convert(int,MAX(Last4)) + 1) + 10000),4)
> >> > FROM Table1_V
> >> > WHERE JDate => >> > right(convert(char(4),datepart(year,getdate())),2) +
> >> > right(convert(char(4),datepart(dayofyear,getdate())+1000),3)
> >> > AND First6 = SUBSTRING(@.front,1,6)
> >> >GO
> >> >
> >> >EXEC Demonstration 'JCV-BCD-RBSV'
> >> >
> >> >SELECT *
> >> > FROM Table2
> >> >
> >> >StrungOut
> >> >--
> >> >JCV-BCD-RBSV-06242-0006
> >> >
> >> >Also, in the spec you mentioned matching on the first six characters,
> >> >but I wondered if it might have actually been the first seven.
> >> >
> >> >One final point worth making. It would be quite practical to modify
> >> >this so that rather than taking in a string as a parameter, it
> >> >produced a new row such as this for each Front6 in Table1 that matches
> >> >the current date.
> >> >
> >> >Roy Harvey
> >> >Beacon Falls, CT
> >> >
> >> >On Wed, 30 Aug 2006 09:09:02 -0700, Paul
> >> ><Paul@.discussions.microsoft.com> wrote:
> >> >
> >> >>Hi thanks for the response. Here are more details on what I am trying to do.
> >> >>There is a table (table1) that has hundreds of records that look like
> >> >>JTB-ABC-MDTC-06200-0001
> >> >>JCV-BCD-ABAM-06201-0001
> >> >>JTB-ABC-MDAC-06200-0002
> >> >>
> >> >>I need the stored procedure to take the value
> >> >>JCV-BCD-RBSV
> >> >>and build the rest of it based on the following conditions and then save it
> >> >>to a table.
> >> >>Get the current julian date, today would be 06242, two hundred forty two day
> >> >>of year 06. The value we are building would then look like JVC-BCD-RBSV-06242
> >> >>and only the last section still to be built. This is done by doing the
> >> >>following.
> >> >>1. Compare the jul date for the day the stored procedure will run (06242)
> >> >>and find all records in table 1 with the same date (call this subset a).
> >> >>2. Next out of subset a find all that match the first 6 letters (create
> >> >>subset b).
> >> >>3. Next out of subset b find the greatest value of the last 4 numbers (say
> >> >>it was 0002).
> >> >>4. Finally increment this value by 1 and use it to finish the newly created
> >> >>value, so we would have JVC-BCD-RBSV-06242-0003.
> >> >>This is easy to do in vb or C#.
> >>
>|||If the proc should NOT add an entry based on conditions that it can
test in the database, then by all means put those tests in the proc,
and just schedule it to run unconditionally. Coding to prevent bad
data in your database is what we all strive for. It also means you
can schedule it to simply execute and not worry about it.
Roy Harvey
Beacon Falls, CT
On Wed, 30 Aug 2006 14:33:01 -0700, Paul
<Paul@.discussions.microsoft.com> wrote:
>I tried out the sample and it worked. Anyhow just had a quick last question.
> Do you know if there is a way to conditionally run a job? I am thinking of
>scheduling the stored procedure but in some cases if a manual data entry has
>taken place (through an asp.net web application) I will not want to add a new
>record with the scheduled job. I guess this could be properly handled in the
>stored procedure(scheduled job), possibly perform some type of table check to
>see when the last entry took place to know weather or not to add a record.
>Thanks.|||ok sounds like a good idea!
--
Paul G
Software engineer.
"Roy Harvey" wrote:
> If the proc should NOT add an entry based on conditions that it can
> test in the database, then by all means put those tests in the proc,
> and just schedule it to run unconditionally. Coding to prevent bad
> data in your database is what we all strive for. It also means you
> can schedule it to simply execute and not worry about it.
> Roy Harvey
> Beacon Falls, CT
> On Wed, 30 Aug 2006 14:33:01 -0700, Paul
> <Paul@.discussions.microsoft.com> wrote:
> >I tried out the sample and it worked. Anyhow just had a quick last question.
> > Do you know if there is a way to conditionally run a job? I am thinking of
> >scheduling the stored procedure but in some cases if a manual data entry has
> >taken place (through an asp.net web application) I will not want to add a new
> >record with the scheduled job. I guess this could be properly handled in the
> >stored procedure(scheduled job), possibly perform some type of table check to
> >see when the last entry took place to know weather or not to add a record.
> >Thanks.
>
Showing posts with label sql2000. Show all posts
Showing posts with label sql2000. Show all posts
Monday, March 19, 2012
can this be done in SQL2000
Hi I need to create a stored procedure that can do the following but now sur
e
if it can be done with sql2000.
1. read in existing data from a table.
2. create the current Julian date.
3. make a comparison and add a sequence number onto this number if it is a
specific Julian date.
I think all of this could probably be done with 2005 since it allows using
C#,vb for TSQL.
Paul G
Software engineer.On Wed, 30 Aug 2006 08:18:02 -0700, Paul
<Paul@.discussions.microsoft.com> wrote:
>Hi I need to create a stored procedure that can do the following but now su
re
>if it can be done with sql2000.
>1. read in existing data from a table.
Stored procedures are very good at retrieving data from database
tables.
>2. create the current Julian date.
SQL Server has sufficient tools for date manipulation that calculating
Julian date from the current date (getdate()) should be no problem. It
does, however, require knowing which definition of Julian date is
intended.
>3. make a comparison and add a sequence number onto this number if it is a
>specific Julian date.
Comparison of what to what? By "this number" do you mean the Julian
data calculated in item 2? What specific Julian date? One passed as
a parameter to the stored procedure? One retrieved from the table in
item 1?
>I think all of this could probably be done with 2005 since it allows using
>C#,vb for TSQL.
I am sure it can be done in 2005. It is unclear from the information
give that it will require C# or VB, but if it turns out to be
complicated they are available. Perhaps if you provided a bit more
detail someone will be able to suggest an appropriate approach.
>Paul G
>Software engineer.
Roy Harvey
Beacon Falls, CT|||Hi thanks for the response. Here are more details on what I am trying to do.
There is a table (table1) that has hundreds of records that look like
JTB-ABC-MDTC-06200-0001
JCV-BCD-ABAM-06201-0001
JTB-ABC-MDAC-06200-0002
I need the stored procedure to take the value
JCV-BCD-RBSV
and build the rest of it based on the following conditions and then save it
to a table.
Get the current julian date, today would be 06242, two hundred forty two day
of year 06. The value we are building would then look like JVC-BCD-RBSV-0624
2
and only the last section still to be built. This is done by doing the
following.
1. Compare the jul date for the day the stored procedure will run (06242)
and find all records in table 1 with the same date (call this subset a).
2. Next out of subset a find all that match the first 6 letters (create
subset b).
3. Next out of subset b find the greatest value of the last 4 numbers (say
it was 0002).
4. Finally increment this value by 1 and use it to finish the newly created
value, so we would have JVC-BCD-RBSV-06242-0003.
This is easy to do in vb or C#.
--
Paul G
Software engineer.
"Roy Harvey" wrote:
> On Wed, 30 Aug 2006 08:18:02 -0700, Paul
> <Paul@.discussions.microsoft.com> wrote:
>
> Stored procedures are very good at retrieving data from database
> tables.
>
> SQL Server has sufficient tools for date manipulation that calculating
> Julian date from the current date (getdate()) should be no problem. It
> does, however, require knowing which definition of Julian date is
> intended.
>
> Comparison of what to what? By "this number" do you mean the Julian
> data calculated in item 2? What specific Julian date? One passed as
> a parameter to the stored procedure? One retrieved from the table in
> item 1?
>
> I am sure it can be done in 2005. It is unclear from the information
> give that it will require C# or VB, but if it turns out to be
> complicated they are available. Perhaps if you provided a bit more
> detail someone will be able to suggest an appropriate approach.
>
> Roy Harvey
> Beacon Falls, CT
>|||Of course all the parts of that complex column should be individual
table columns, but I will not belabor that point.
There is nothing about that which requires going to C# or VB. This
should give you some ideas. Note that I used a view, but each of the
pieces could have been substringed out when references. However since
all the real work is one in one SQL command, all those references
would make it a good bit more opaque. Another advantage to the view
is that it is possible to make it an indexed view, which could make a
major difference in performance.
CREATE TABLE Table1
(StrungOut char(23) NOT NULL)
INSERT Table1 values ('JTB-ABC-MDTC-06200-0001')
INSERT Table1 values ('JCV-BCD-ABAM-06201-0001')
INSERT Table1 values ('JTB-ABC-MDAC-06200-0002')
INSERT Table1 values ('JCV-BCD-ABAM-06242-0005')
GO
CREATE VIEW Table1_V
AS
SELECT StrungOut,
First6 = SUBSTRING(StrungOut,1,6),
JDate = SUBSTRING(StrungOut,14,5),
JYear = SUBSTRING(StrungOut,14,2),
JDay = SUBSTRING(StrungOut,16,3),
Last4 = SUBSTRING(Strungout,20,4)
FROM Table1
GO
CREATE TABLE Table2
(StrungOut char(23) NOT NULL)
GO
CREATE PROC Demonstration
@.front char(12)
AS
INSERT Table2
SELECT @.front + '-' +
right(convert(char(4),datepart(year,getd
ate())),2) +
right(convert(char(4),datepart(dayofyear
,getdate())+1000),3) +
'-' +
RIGHT(convert(char(5),(convert(int,MAX(L
ast4)) + 1) + 10000),4)
FROM Table1_V
WHERE JDate =
right(convert(char(4),datepart(year,getd
ate())),2) +
right(convert(char(4),datepart(dayofyear
,getdate())+1000),3)
AND First6 = SUBSTRING(@.front,1,6)
GO
EXEC Demonstration 'JCV-BCD-RBSV'
SELECT *
FROM Table2
StrungOut
--
JCV-BCD-RBSV-06242-0006
Also, in the spec you mentioned matching on the first six characters,
but I wondered if it might have actually been the first seven.
One final point worth making. It would be quite practical to modify
this so that rather than taking in a string as a parameter, it
produced a new row such as this for each Front6 in Table1 that matches
the current date.
Roy Harvey
Beacon Falls, CT
On Wed, 30 Aug 2006 09:09:02 -0700, Paul
<Paul@.discussions.microsoft.com> wrote:
>Hi thanks for the response. Here are more details on what I am trying to do
.
>There is a table (table1) that has hundreds of records that look like
>JTB-ABC-MDTC-06200-0001
>JCV-BCD-ABAM-06201-0001
>JTB-ABC-MDAC-06200-0002
>I need the stored procedure to take the value
>JCV-BCD-RBSV
>and build the rest of it based on the following conditions and then save it
>to a table.
>Get the current julian date, today would be 06242, two hundred forty two da
y
>of year 06. The value we are building would then look like JVC-BCD-RBSV-062
42
>and only the last section still to be built. This is done by doing the
>following.
>1. Compare the jul date for the day the stored procedure will run (06242)
>and find all records in table 1 with the same date (call this subset a).
>2. Next out of subset a find all that match the first 6 letters (create
>subset b).
>3. Next out of subset b find the greatest value of the last 4 numbers (say
>it was 0002).
>4. Finally increment this value by 1 and use it to finish the newly created
>value, so we would have JVC-BCD-RBSV-06242-0003.
>This is easy to do in vb or C#.|||An alternate coding of the WHERE clause:
WHERE JYear =
right(convert(char(4),datepart(year,getd
ate())),2)
AND JDay =
right(convert(char(4),datepart(dayofyear
,getdate())+1000),3)
AND First6 = SUBSTRING(@.front,1,6)
Roy
On Wed, 30 Aug 2006 13:00:08 -0400, Roy Harvey <roy_harvey@.snet.net>
wrote:
[vbcol=seagreen]
>Of course all the parts of that complex column should be individual
>table columns, but I will not belabor that point.
>There is nothing about that which requires going to C# or VB. This
>should give you some ideas. Note that I used a view, but each of the
>pieces could have been substringed out when references. However since
>all the real work is one in one SQL command, all those references
>would make it a good bit more opaque. Another advantage to the view
>is that it is possible to make it an indexed view, which could make a
>major difference in performance.
>CREATE TABLE Table1
>(StrungOut char(23) NOT NULL)
>INSERT Table1 values ('JTB-ABC-MDTC-06200-0001')
>INSERT Table1 values ('JCV-BCD-ABAM-06201-0001')
>INSERT Table1 values ('JTB-ABC-MDAC-06200-0002')
>INSERT Table1 values ('JCV-BCD-ABAM-06242-0005')
>GO
>CREATE VIEW Table1_V
>AS
>SELECT StrungOut,
> First6 = SUBSTRING(StrungOut,1,6),
> JDate = SUBSTRING(StrungOut,14,5),
> JYear = SUBSTRING(StrungOut,14,2),
> JDay = SUBSTRING(StrungOut,16,3),
> Last4 = SUBSTRING(Strungout,20,4)
> FROM Table1
>GO
>CREATE TABLE Table2
>(StrungOut char(23) NOT NULL)
>GO
>CREATE PROC Demonstration
>@.front char(12)
>AS
>INSERT Table2
>SELECT @.front + '-' +
> right(convert(char(4),datepart(year,getd
ate())),2) +
> right(convert(char(4),datepart(dayofyear
,getdate())+1000),3) +
> '-' +
> RIGHT(convert(char(5),(convert(int,MAX(L
ast4)) + 1) + 10000),4)
> FROM Table1_V
> WHERE JDate =
> right(convert(char(4),datepart(year,getd
ate())),2) +
> right(convert(char(4),datepart(dayofyear
,getdate())+1000),3)
> AND First6 = SUBSTRING(@.front,1,6)
>GO
>EXEC Demonstration 'JCV-BCD-RBSV'
>SELECT *
> FROM Table2
>StrungOut
>--
>JCV-BCD-RBSV-06242-0006
>Also, in the spec you mentioned matching on the first six characters,
>but I wondered if it might have actually been the first seven.
>One final point worth making. It would be quite practical to modify
>this so that rather than taking in a string as a parameter, it
>produced a new row such as this for each Front6 in Table1 that matches
>the current date.
>Roy Harvey
>Beacon Falls, CT
>On Wed, 30 Aug 2006 09:09:02 -0700, Paul
><Paul@.discussions.microsoft.com> wrote:
>|||Hi thanks for the response. Yes the table was already setup and there was
not time to restructure. Will take a look at what you have. Was not aware
that you can do a lot with SQL.
--
Paul G
Software engineer.
"Roy Harvey" wrote:
> Of course all the parts of that complex column should be individual
> table columns, but I will not belabor that point.
> There is nothing about that which requires going to C# or VB. This
> should give you some ideas. Note that I used a view, but each of the
> pieces could have been substringed out when references. However since
> all the real work is one in one SQL command, all those references
> would make it a good bit more opaque. Another advantage to the view
> is that it is possible to make it an indexed view, which could make a
> major difference in performance.
> CREATE TABLE Table1
> (StrungOut char(23) NOT NULL)
> INSERT Table1 values ('JTB-ABC-MDTC-06200-0001')
> INSERT Table1 values ('JCV-BCD-ABAM-06201-0001')
> INSERT Table1 values ('JTB-ABC-MDAC-06200-0002')
> INSERT Table1 values ('JCV-BCD-ABAM-06242-0005')
> GO
> CREATE VIEW Table1_V
> AS
> SELECT StrungOut,
> First6 = SUBSTRING(StrungOut,1,6),
> JDate = SUBSTRING(StrungOut,14,5),
> JYear = SUBSTRING(StrungOut,14,2),
> JDay = SUBSTRING(StrungOut,16,3),
> Last4 = SUBSTRING(Strungout,20,4)
> FROM Table1
> GO
> CREATE TABLE Table2
> (StrungOut char(23) NOT NULL)
> GO
> CREATE PROC Demonstration
> @.front char(12)
> AS
> INSERT Table2
> SELECT @.front + '-' +
> right(convert(char(4),datepart(year,getd
ate())),2) +
> right(convert(char(4),datepart(dayofyear
,getdate())+1000),3) +
> '-' +
> RIGHT(convert(char(5),(convert(int,MAX(L
ast4)) + 1) + 10000),4)
> FROM Table1_V
> WHERE JDate =
> right(convert(char(4),datepart(year,getd
ate())),2) +
> right(convert(char(4),datepart(dayofyear
,getdate())+1000),3)
> AND First6 = SUBSTRING(@.front,1,6)
> GO
> EXEC Demonstration 'JCV-BCD-RBSV'
> SELECT *
> FROM Table2
> StrungOut
> --
> JCV-BCD-RBSV-06242-0006
> Also, in the spec you mentioned matching on the first six characters,
> but I wondered if it might have actually been the first seven.
> One final point worth making. It would be quite practical to modify
> this so that rather than taking in a string as a parameter, it
> produced a new row such as this for each Front6 in Table1 that matches
> the current date.
> Roy Harvey
> Beacon Falls, CT
> On Wed, 30 Aug 2006 09:09:02 -0700, Paul
> <Paul@.discussions.microsoft.com> wrote:
>
>|||I see were you get the current julian date, JYear and JDay but I did not see
if combine these to get the 06242 for example for today. thanks.
Paul G
Software engineer.
"Roy Harvey" wrote:
> An alternate coding of the WHERE clause:
> WHERE JYear =
> right(convert(char(4),datepart(year,getd
ate())),2)
> AND JDay =
> right(convert(char(4),datepart(dayofyear
,getdate())+1000),3)
> AND First6 = SUBSTRING(@.front,1,6)
> Roy
> On Wed, 30 Aug 2006 13:00:08 -0400, Roy Harvey <roy_harvey@.snet.net>
> wrote:
>
>|||JYear and JDay are the pieces of the Julian date in Table1, so they
are only used for the comparison.
In the assignment:
SELECT @.front + '-' +
right(convert(char(4),datepart(year,getd
ate())),2) +
right(convert(char(4),datepart(dayofyear
,getdate())+1000),3) +
'-' +
RIGHT(convert(char(5),(convert(int,MAX(L
ast4)) + 1) + 10000),4)
the Julian date part of the output string is the second and third
lines. BUT, I just thought of an alternate way to code the
assignment. We went to all that trouble to make sure Table1_V.JDate
matched the current day, so instead of using the current day we could
just use Table1_V.JDate.
SELECT @.front + '-' +
JDate +
'-' +
RIGHT(convert(char(5),(convert(int,MAX(L
ast4)) + 1) + 10000),4)
However, I'm guessing that IF there is no matching row with the
current date you might actually want to create the new row with 0000
or 0001 as the final part of the string. In that case I would keep to
using the derivation from getdate() as it will be easier to code in
the row-not-found branch.
Roy Harvey
Beacon Falls, CT
On Wed, 30 Aug 2006 10:32:01 -0700, Paul
<Paul@.discussions.microsoft.com> wrote:
[vbcol=seagreen]
>I see were you get the current julian date, JYear and JDay but I did not se
e
>if combine these to get the 06242 for example for today. thanks.
>Paul G
>Software engineer.
>
>"Roy Harvey" wrote:
>|||ok thanks for the information.
--
Paul G
Software engineer.
"Roy Harvey" wrote:
> JYear and JDay are the pieces of the Julian date in Table1, so they
> are only used for the comparison.
> In the assignment:
> SELECT @.front + '-' +
> right(convert(char(4),datepart(year,getd
ate())),2) +
> right(convert(char(4),datepart(dayofyear
,getdate())+1000),3) +
> '-' +
> RIGHT(convert(char(5),(convert(int,MAX(L
ast4)) + 1) + 10000),4)
> the Julian date part of the output string is the second and third
> lines. BUT, I just thought of an alternate way to code the
> assignment. We went to all that trouble to make sure Table1_V.JDate
> matched the current day, so instead of using the current day we could
> just use Table1_V.JDate.
> SELECT @.front + '-' +
> JDate +
> '-' +
> RIGHT(convert(char(5),(convert(int,MAX(L
ast4)) + 1) + 10000),4)
> However, I'm guessing that IF there is no matching row with the
> current date you might actually want to create the new row with 0000
> or 0001 as the final part of the string. In that case I would keep to
> using the derivation from getdate() as it will be easier to code in
> the row-not-found branch.
> Roy Harvey
> Beacon Falls, CT
> On Wed, 30 Aug 2006 10:32:01 -0700, Paul
> <Paul@.discussions.microsoft.com> wrote:
>
>|||I tried out the sample and it worked. Anyhow just had a quick last question
.
Do you know if there is a way to conditionally run a job? I am thinking of
scheduling the stored procedure but in some cases if a manual data entry has
taken place (through an asp.net web application) I will not want to add a ne
w
record with the scheduled job. I guess this could be properly handled in th
e
stored procedure(scheduled job), possibly perform some type of table check t
o
see when the last entry took place to know weather or not to add a record.
Thanks.
--
Paul G
Software engineer.
"Roy Harvey" wrote:
> JYear and JDay are the pieces of the Julian date in Table1, so they
> are only used for the comparison.
> In the assignment:
> SELECT @.front + '-' +
> right(convert(char(4),datepart(year,getd
ate())),2) +
> right(convert(char(4),datepart(dayofyear
,getdate())+1000),3) +
> '-' +
> RIGHT(convert(char(5),(convert(int,MAX(L
ast4)) + 1) + 10000),4)
> the Julian date part of the output string is the second and third
> lines. BUT, I just thought of an alternate way to code the
> assignment. We went to all that trouble to make sure Table1_V.JDate
> matched the current day, so instead of using the current day we could
> just use Table1_V.JDate.
> SELECT @.front + '-' +
> JDate +
> '-' +
> RIGHT(convert(char(5),(convert(int,MAX(L
ast4)) + 1) + 10000),4)
> However, I'm guessing that IF there is no matching row with the
> current date you might actually want to create the new row with 0000
> or 0001 as the final part of the string. In that case I would keep to
> using the derivation from getdate() as it will be easier to code in
> the row-not-found branch.
> Roy Harvey
> Beacon Falls, CT
> On Wed, 30 Aug 2006 10:32:01 -0700, Paul
> <Paul@.discussions.microsoft.com> wrote:
>
>
e
if it can be done with sql2000.
1. read in existing data from a table.
2. create the current Julian date.
3. make a comparison and add a sequence number onto this number if it is a
specific Julian date.
I think all of this could probably be done with 2005 since it allows using
C#,vb for TSQL.
Paul G
Software engineer.On Wed, 30 Aug 2006 08:18:02 -0700, Paul
<Paul@.discussions.microsoft.com> wrote:
>Hi I need to create a stored procedure that can do the following but now su
re
>if it can be done with sql2000.
>1. read in existing data from a table.
Stored procedures are very good at retrieving data from database
tables.
>2. create the current Julian date.
SQL Server has sufficient tools for date manipulation that calculating
Julian date from the current date (getdate()) should be no problem. It
does, however, require knowing which definition of Julian date is
intended.
>3. make a comparison and add a sequence number onto this number if it is a
>specific Julian date.
Comparison of what to what? By "this number" do you mean the Julian
data calculated in item 2? What specific Julian date? One passed as
a parameter to the stored procedure? One retrieved from the table in
item 1?
>I think all of this could probably be done with 2005 since it allows using
>C#,vb for TSQL.
I am sure it can be done in 2005. It is unclear from the information
give that it will require C# or VB, but if it turns out to be
complicated they are available. Perhaps if you provided a bit more
detail someone will be able to suggest an appropriate approach.
>Paul G
>Software engineer.
Roy Harvey
Beacon Falls, CT|||Hi thanks for the response. Here are more details on what I am trying to do.
There is a table (table1) that has hundreds of records that look like
JTB-ABC-MDTC-06200-0001
JCV-BCD-ABAM-06201-0001
JTB-ABC-MDAC-06200-0002
I need the stored procedure to take the value
JCV-BCD-RBSV
and build the rest of it based on the following conditions and then save it
to a table.
Get the current julian date, today would be 06242, two hundred forty two day
of year 06. The value we are building would then look like JVC-BCD-RBSV-0624
2
and only the last section still to be built. This is done by doing the
following.
1. Compare the jul date for the day the stored procedure will run (06242)
and find all records in table 1 with the same date (call this subset a).
2. Next out of subset a find all that match the first 6 letters (create
subset b).
3. Next out of subset b find the greatest value of the last 4 numbers (say
it was 0002).
4. Finally increment this value by 1 and use it to finish the newly created
value, so we would have JVC-BCD-RBSV-06242-0003.
This is easy to do in vb or C#.
--
Paul G
Software engineer.
"Roy Harvey" wrote:
> On Wed, 30 Aug 2006 08:18:02 -0700, Paul
> <Paul@.discussions.microsoft.com> wrote:
>
> Stored procedures are very good at retrieving data from database
> tables.
>
> SQL Server has sufficient tools for date manipulation that calculating
> Julian date from the current date (getdate()) should be no problem. It
> does, however, require knowing which definition of Julian date is
> intended.
>
> Comparison of what to what? By "this number" do you mean the Julian
> data calculated in item 2? What specific Julian date? One passed as
> a parameter to the stored procedure? One retrieved from the table in
> item 1?
>
> I am sure it can be done in 2005. It is unclear from the information
> give that it will require C# or VB, but if it turns out to be
> complicated they are available. Perhaps if you provided a bit more
> detail someone will be able to suggest an appropriate approach.
>
> Roy Harvey
> Beacon Falls, CT
>|||Of course all the parts of that complex column should be individual
table columns, but I will not belabor that point.
There is nothing about that which requires going to C# or VB. This
should give you some ideas. Note that I used a view, but each of the
pieces could have been substringed out when references. However since
all the real work is one in one SQL command, all those references
would make it a good bit more opaque. Another advantage to the view
is that it is possible to make it an indexed view, which could make a
major difference in performance.
CREATE TABLE Table1
(StrungOut char(23) NOT NULL)
INSERT Table1 values ('JTB-ABC-MDTC-06200-0001')
INSERT Table1 values ('JCV-BCD-ABAM-06201-0001')
INSERT Table1 values ('JTB-ABC-MDAC-06200-0002')
INSERT Table1 values ('JCV-BCD-ABAM-06242-0005')
GO
CREATE VIEW Table1_V
AS
SELECT StrungOut,
First6 = SUBSTRING(StrungOut,1,6),
JDate = SUBSTRING(StrungOut,14,5),
JYear = SUBSTRING(StrungOut,14,2),
JDay = SUBSTRING(StrungOut,16,3),
Last4 = SUBSTRING(Strungout,20,4)
FROM Table1
GO
CREATE TABLE Table2
(StrungOut char(23) NOT NULL)
GO
CREATE PROC Demonstration
@.front char(12)
AS
INSERT Table2
SELECT @.front + '-' +
right(convert(char(4),datepart(year,getd
ate())),2) +
right(convert(char(4),datepart(dayofyear
,getdate())+1000),3) +
'-' +
RIGHT(convert(char(5),(convert(int,MAX(L
ast4)) + 1) + 10000),4)
FROM Table1_V
WHERE JDate =
right(convert(char(4),datepart(year,getd
ate())),2) +
right(convert(char(4),datepart(dayofyear
,getdate())+1000),3)
AND First6 = SUBSTRING(@.front,1,6)
GO
EXEC Demonstration 'JCV-BCD-RBSV'
SELECT *
FROM Table2
StrungOut
--
JCV-BCD-RBSV-06242-0006
Also, in the spec you mentioned matching on the first six characters,
but I wondered if it might have actually been the first seven.
One final point worth making. It would be quite practical to modify
this so that rather than taking in a string as a parameter, it
produced a new row such as this for each Front6 in Table1 that matches
the current date.
Roy Harvey
Beacon Falls, CT
On Wed, 30 Aug 2006 09:09:02 -0700, Paul
<Paul@.discussions.microsoft.com> wrote:
>Hi thanks for the response. Here are more details on what I am trying to do
.
>There is a table (table1) that has hundreds of records that look like
>JTB-ABC-MDTC-06200-0001
>JCV-BCD-ABAM-06201-0001
>JTB-ABC-MDAC-06200-0002
>I need the stored procedure to take the value
>JCV-BCD-RBSV
>and build the rest of it based on the following conditions and then save it
>to a table.
>Get the current julian date, today would be 06242, two hundred forty two da
y
>of year 06. The value we are building would then look like JVC-BCD-RBSV-062
42
>and only the last section still to be built. This is done by doing the
>following.
>1. Compare the jul date for the day the stored procedure will run (06242)
>and find all records in table 1 with the same date (call this subset a).
>2. Next out of subset a find all that match the first 6 letters (create
>subset b).
>3. Next out of subset b find the greatest value of the last 4 numbers (say
>it was 0002).
>4. Finally increment this value by 1 and use it to finish the newly created
>value, so we would have JVC-BCD-RBSV-06242-0003.
>This is easy to do in vb or C#.|||An alternate coding of the WHERE clause:
WHERE JYear =
right(convert(char(4),datepart(year,getd
ate())),2)
AND JDay =
right(convert(char(4),datepart(dayofyear
,getdate())+1000),3)
AND First6 = SUBSTRING(@.front,1,6)
Roy
On Wed, 30 Aug 2006 13:00:08 -0400, Roy Harvey <roy_harvey@.snet.net>
wrote:
[vbcol=seagreen]
>Of course all the parts of that complex column should be individual
>table columns, but I will not belabor that point.
>There is nothing about that which requires going to C# or VB. This
>should give you some ideas. Note that I used a view, but each of the
>pieces could have been substringed out when references. However since
>all the real work is one in one SQL command, all those references
>would make it a good bit more opaque. Another advantage to the view
>is that it is possible to make it an indexed view, which could make a
>major difference in performance.
>CREATE TABLE Table1
>(StrungOut char(23) NOT NULL)
>INSERT Table1 values ('JTB-ABC-MDTC-06200-0001')
>INSERT Table1 values ('JCV-BCD-ABAM-06201-0001')
>INSERT Table1 values ('JTB-ABC-MDAC-06200-0002')
>INSERT Table1 values ('JCV-BCD-ABAM-06242-0005')
>GO
>CREATE VIEW Table1_V
>AS
>SELECT StrungOut,
> First6 = SUBSTRING(StrungOut,1,6),
> JDate = SUBSTRING(StrungOut,14,5),
> JYear = SUBSTRING(StrungOut,14,2),
> JDay = SUBSTRING(StrungOut,16,3),
> Last4 = SUBSTRING(Strungout,20,4)
> FROM Table1
>GO
>CREATE TABLE Table2
>(StrungOut char(23) NOT NULL)
>GO
>CREATE PROC Demonstration
>@.front char(12)
>AS
>INSERT Table2
>SELECT @.front + '-' +
> right(convert(char(4),datepart(year,getd
ate())),2) +
> right(convert(char(4),datepart(dayofyear
,getdate())+1000),3) +
> '-' +
> RIGHT(convert(char(5),(convert(int,MAX(L
ast4)) + 1) + 10000),4)
> FROM Table1_V
> WHERE JDate =
> right(convert(char(4),datepart(year,getd
ate())),2) +
> right(convert(char(4),datepart(dayofyear
,getdate())+1000),3)
> AND First6 = SUBSTRING(@.front,1,6)
>GO
>EXEC Demonstration 'JCV-BCD-RBSV'
>SELECT *
> FROM Table2
>StrungOut
>--
>JCV-BCD-RBSV-06242-0006
>Also, in the spec you mentioned matching on the first six characters,
>but I wondered if it might have actually been the first seven.
>One final point worth making. It would be quite practical to modify
>this so that rather than taking in a string as a parameter, it
>produced a new row such as this for each Front6 in Table1 that matches
>the current date.
>Roy Harvey
>Beacon Falls, CT
>On Wed, 30 Aug 2006 09:09:02 -0700, Paul
><Paul@.discussions.microsoft.com> wrote:
>|||Hi thanks for the response. Yes the table was already setup and there was
not time to restructure. Will take a look at what you have. Was not aware
that you can do a lot with SQL.
--
Paul G
Software engineer.
"Roy Harvey" wrote:
> Of course all the parts of that complex column should be individual
> table columns, but I will not belabor that point.
> There is nothing about that which requires going to C# or VB. This
> should give you some ideas. Note that I used a view, but each of the
> pieces could have been substringed out when references. However since
> all the real work is one in one SQL command, all those references
> would make it a good bit more opaque. Another advantage to the view
> is that it is possible to make it an indexed view, which could make a
> major difference in performance.
> CREATE TABLE Table1
> (StrungOut char(23) NOT NULL)
> INSERT Table1 values ('JTB-ABC-MDTC-06200-0001')
> INSERT Table1 values ('JCV-BCD-ABAM-06201-0001')
> INSERT Table1 values ('JTB-ABC-MDAC-06200-0002')
> INSERT Table1 values ('JCV-BCD-ABAM-06242-0005')
> GO
> CREATE VIEW Table1_V
> AS
> SELECT StrungOut,
> First6 = SUBSTRING(StrungOut,1,6),
> JDate = SUBSTRING(StrungOut,14,5),
> JYear = SUBSTRING(StrungOut,14,2),
> JDay = SUBSTRING(StrungOut,16,3),
> Last4 = SUBSTRING(Strungout,20,4)
> FROM Table1
> GO
> CREATE TABLE Table2
> (StrungOut char(23) NOT NULL)
> GO
> CREATE PROC Demonstration
> @.front char(12)
> AS
> INSERT Table2
> SELECT @.front + '-' +
> right(convert(char(4),datepart(year,getd
ate())),2) +
> right(convert(char(4),datepart(dayofyear
,getdate())+1000),3) +
> '-' +
> RIGHT(convert(char(5),(convert(int,MAX(L
ast4)) + 1) + 10000),4)
> FROM Table1_V
> WHERE JDate =
> right(convert(char(4),datepart(year,getd
ate())),2) +
> right(convert(char(4),datepart(dayofyear
,getdate())+1000),3)
> AND First6 = SUBSTRING(@.front,1,6)
> GO
> EXEC Demonstration 'JCV-BCD-RBSV'
> SELECT *
> FROM Table2
> StrungOut
> --
> JCV-BCD-RBSV-06242-0006
> Also, in the spec you mentioned matching on the first six characters,
> but I wondered if it might have actually been the first seven.
> One final point worth making. It would be quite practical to modify
> this so that rather than taking in a string as a parameter, it
> produced a new row such as this for each Front6 in Table1 that matches
> the current date.
> Roy Harvey
> Beacon Falls, CT
> On Wed, 30 Aug 2006 09:09:02 -0700, Paul
> <Paul@.discussions.microsoft.com> wrote:
>
>|||I see were you get the current julian date, JYear and JDay but I did not see
if combine these to get the 06242 for example for today. thanks.
Paul G
Software engineer.
"Roy Harvey" wrote:
> An alternate coding of the WHERE clause:
> WHERE JYear =
> right(convert(char(4),datepart(year,getd
ate())),2)
> AND JDay =
> right(convert(char(4),datepart(dayofyear
,getdate())+1000),3)
> AND First6 = SUBSTRING(@.front,1,6)
> Roy
> On Wed, 30 Aug 2006 13:00:08 -0400, Roy Harvey <roy_harvey@.snet.net>
> wrote:
>
>|||JYear and JDay are the pieces of the Julian date in Table1, so they
are only used for the comparison.
In the assignment:
SELECT @.front + '-' +
right(convert(char(4),datepart(year,getd
ate())),2) +
right(convert(char(4),datepart(dayofyear
,getdate())+1000),3) +
'-' +
RIGHT(convert(char(5),(convert(int,MAX(L
ast4)) + 1) + 10000),4)
the Julian date part of the output string is the second and third
lines. BUT, I just thought of an alternate way to code the
assignment. We went to all that trouble to make sure Table1_V.JDate
matched the current day, so instead of using the current day we could
just use Table1_V.JDate.
SELECT @.front + '-' +
JDate +
'-' +
RIGHT(convert(char(5),(convert(int,MAX(L
ast4)) + 1) + 10000),4)
However, I'm guessing that IF there is no matching row with the
current date you might actually want to create the new row with 0000
or 0001 as the final part of the string. In that case I would keep to
using the derivation from getdate() as it will be easier to code in
the row-not-found branch.
Roy Harvey
Beacon Falls, CT
On Wed, 30 Aug 2006 10:32:01 -0700, Paul
<Paul@.discussions.microsoft.com> wrote:
[vbcol=seagreen]
>I see were you get the current julian date, JYear and JDay but I did not se
e
>if combine these to get the 06242 for example for today. thanks.
>Paul G
>Software engineer.
>
>"Roy Harvey" wrote:
>|||ok thanks for the information.
--
Paul G
Software engineer.
"Roy Harvey" wrote:
> JYear and JDay are the pieces of the Julian date in Table1, so they
> are only used for the comparison.
> In the assignment:
> SELECT @.front + '-' +
> right(convert(char(4),datepart(year,getd
ate())),2) +
> right(convert(char(4),datepart(dayofyear
,getdate())+1000),3) +
> '-' +
> RIGHT(convert(char(5),(convert(int,MAX(L
ast4)) + 1) + 10000),4)
> the Julian date part of the output string is the second and third
> lines. BUT, I just thought of an alternate way to code the
> assignment. We went to all that trouble to make sure Table1_V.JDate
> matched the current day, so instead of using the current day we could
> just use Table1_V.JDate.
> SELECT @.front + '-' +
> JDate +
> '-' +
> RIGHT(convert(char(5),(convert(int,MAX(L
ast4)) + 1) + 10000),4)
> However, I'm guessing that IF there is no matching row with the
> current date you might actually want to create the new row with 0000
> or 0001 as the final part of the string. In that case I would keep to
> using the derivation from getdate() as it will be easier to code in
> the row-not-found branch.
> Roy Harvey
> Beacon Falls, CT
> On Wed, 30 Aug 2006 10:32:01 -0700, Paul
> <Paul@.discussions.microsoft.com> wrote:
>
>|||I tried out the sample and it worked. Anyhow just had a quick last question
.
Do you know if there is a way to conditionally run a job? I am thinking of
scheduling the stored procedure but in some cases if a manual data entry has
taken place (through an asp.net web application) I will not want to add a ne
w
record with the scheduled job. I guess this could be properly handled in th
e
stored procedure(scheduled job), possibly perform some type of table check t
o
see when the last entry took place to know weather or not to add a record.
Thanks.
--
Paul G
Software engineer.
"Roy Harvey" wrote:
> JYear and JDay are the pieces of the Julian date in Table1, so they
> are only used for the comparison.
> In the assignment:
> SELECT @.front + '-' +
> right(convert(char(4),datepart(year,getd
ate())),2) +
> right(convert(char(4),datepart(dayofyear
,getdate())+1000),3) +
> '-' +
> RIGHT(convert(char(5),(convert(int,MAX(L
ast4)) + 1) + 10000),4)
> the Julian date part of the output string is the second and third
> lines. BUT, I just thought of an alternate way to code the
> assignment. We went to all that trouble to make sure Table1_V.JDate
> matched the current day, so instead of using the current day we could
> just use Table1_V.JDate.
> SELECT @.front + '-' +
> JDate +
> '-' +
> RIGHT(convert(char(5),(convert(int,MAX(L
ast4)) + 1) + 10000),4)
> However, I'm guessing that IF there is no matching row with the
> current date you might actually want to create the new row with 0000
> or 0001 as the final part of the string. In that case I would keep to
> using the derivation from getdate() as it will be easier to code in
> the row-not-found branch.
> Roy Harvey
> Beacon Falls, CT
> On Wed, 30 Aug 2006 10:32:01 -0700, Paul
> <Paul@.discussions.microsoft.com> wrote:
>
>
Sunday, March 11, 2012
Can sqlagent.out be cycled
Is there a way of cycling the sqlagent.out file in SQL2000 (similar to
cycling the error logs via the sp_cycle_errorlog stored procedure). If not,
what options do I have to clear the sqlagent.out file without having to stop
the SQL agent.Unfortunately, just restarting the service would do this -
nothing built in to cycle the Agent logs.
-Sue
On Wed, 17 Aug 2005 07:03:04 -0700, "Steve R" <Steve
R@.discussions.microsoft.com> wrote:
>Is there a way of cycling the sqlagent.out file in SQL2000 (similar to
>cycling the error logs via the sp_cycle_errorlog stored procedure). If not,
>what options do I have to clear the sqlagent.out file without having to sto
p
>the SQL agent.
cycling the error logs via the sp_cycle_errorlog stored procedure). If not,
what options do I have to clear the sqlagent.out file without having to stop
the SQL agent.Unfortunately, just restarting the service would do this -
nothing built in to cycle the Agent logs.
-Sue
On Wed, 17 Aug 2005 07:03:04 -0700, "Steve R" <Steve
R@.discussions.microsoft.com> wrote:
>Is there a way of cycling the sqlagent.out file in SQL2000 (similar to
>cycling the error logs via the sp_cycle_errorlog stored procedure). If not,
>what options do I have to clear the sqlagent.out file without having to sto
p
>the SQL agent.
Can sqlagent.out be cycled
Is there a way of cycling the sqlagent.out file in SQL2000 (similar to
cycling the error logs via the sp_cycle_errorlog stored procedure). If not,
what options do I have to clear the sqlagent.out file without having to stop
the SQL agent.
Unfortunately, just restarting the service would do this -
nothing built in to cycle the Agent logs.
-Sue
On Wed, 17 Aug 2005 07:03:04 -0700, "Steve R" <Steve
R@.discussions.microsoft.com> wrote:
>Is there a way of cycling the sqlagent.out file in SQL2000 (similar to
>cycling the error logs via the sp_cycle_errorlog stored procedure). If not,
>what options do I have to clear the sqlagent.out file without having to stop
>the SQL agent.
cycling the error logs via the sp_cycle_errorlog stored procedure). If not,
what options do I have to clear the sqlagent.out file without having to stop
the SQL agent.
Unfortunately, just restarting the service would do this -
nothing built in to cycle the Agent logs.
-Sue
On Wed, 17 Aug 2005 07:03:04 -0700, "Steve R" <Steve
R@.discussions.microsoft.com> wrote:
>Is there a way of cycling the sqlagent.out file in SQL2000 (similar to
>cycling the error logs via the sp_cycle_errorlog stored procedure). If not,
>what options do I have to clear the sqlagent.out file without having to stop
>the SQL agent.
Can sqlagent.out be cycled
Is there a way of cycling the sqlagent.out file in SQL2000 (similar to
cycling the error logs via the sp_cycle_errorlog stored procedure). If not,
what options do I have to clear the sqlagent.out file without having to stop
the SQL agent.Unfortunately, just restarting the service would do this -
nothing built in to cycle the Agent logs.
-Sue
On Wed, 17 Aug 2005 07:03:04 -0700, "Steve R" <Steve
R@.discussions.microsoft.com> wrote:
>Is there a way of cycling the sqlagent.out file in SQL2000 (similar to
>cycling the error logs via the sp_cycle_errorlog stored procedure). If not,
>what options do I have to clear the sqlagent.out file without having to stop
>the SQL agent.
cycling the error logs via the sp_cycle_errorlog stored procedure). If not,
what options do I have to clear the sqlagent.out file without having to stop
the SQL agent.Unfortunately, just restarting the service would do this -
nothing built in to cycle the Agent logs.
-Sue
On Wed, 17 Aug 2005 07:03:04 -0700, "Steve R" <Steve
R@.discussions.microsoft.com> wrote:
>Is there a way of cycling the sqlagent.out file in SQL2000 (similar to
>cycling the error logs via the sp_cycle_errorlog stored procedure). If not,
>what options do I have to clear the sqlagent.out file without having to stop
>the SQL agent.
Thursday, March 8, 2012
Can SQL2000 notify me if a new job or DTS is created ?
Hi, ya-all. That's basically my question in a nut shell. Can it, and How
do I set it to ?
Thanks.WANNABE wrote:
> Hi, ya-all. That's basically my question in a nut shell. Can it, and How
> do I set it to ?
> Thanks.
>
There's nothing built-in, but you can easily write something yourself to
monitor the sysjobs and sysdtspackages tables in the MSDB database.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Thanks Tracy, but you over estimate me!!! Although I would love to give it
a try. I have no idea where to start, could you get me started. Be advised
I will be here posting questions about how to proceed, when I become
stumped.
Does anyone know if this is a feature in SQL2005 '
"Tracy McKibben" <tracy@.realsqlguy.com> wrote in message
news:44E47FC4.7010007@.realsqlguy.com...
> WANNABE wrote:
> There's nothing built-in, but you can easily write something yourself to
> monitor the sysjobs and sysdtspackages tables in the MSDB database.
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com
do I set it to ?
Thanks.WANNABE wrote:
> Hi, ya-all. That's basically my question in a nut shell. Can it, and How
> do I set it to ?
> Thanks.
>
There's nothing built-in, but you can easily write something yourself to
monitor the sysjobs and sysdtspackages tables in the MSDB database.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Thanks Tracy, but you over estimate me!!! Although I would love to give it
a try. I have no idea where to start, could you get me started. Be advised
I will be here posting questions about how to proceed, when I become
stumped.
Does anyone know if this is a feature in SQL2005 '
"Tracy McKibben" <tracy@.realsqlguy.com> wrote in message
news:44E47FC4.7010007@.realsqlguy.com...
> WANNABE wrote:
> There's nothing built-in, but you can easily write something yourself to
> monitor the sysjobs and sysdtspackages tables in the MSDB database.
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com
Can SQL2000 notify me if a new job or DTS is created ?
Hi, ya-all. That's basically my question in a nut shell. Can it, and How
do I set it to ?
Thanks.WANNABE wrote:
> Hi, ya-all. That's basically my question in a nut shell. Can it, and How
> do I set it to ?
> Thanks.
>
There's nothing built-in, but you can easily write something yourself to
monitor the sysjobs and sysdtspackages tables in the MSDB database.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Thanks Tracy, but you over estimate me!!! Although I would love to give it
a try. I have no idea where to start, could you get me started. Be advised
I will be here posting questions about how to proceed, when I become
stumped.
Does anyone know if this is a feature in SQL2005 '
"Tracy McKibben" <tracy@.realsqlguy.com> wrote in message
news:44E47FC4.7010007@.realsqlguy.com...
> WANNABE wrote:
>> Hi, ya-all. That's basically my question in a nut shell. Can it, and
>> How do I set it to ?
>> Thanks.
> There's nothing built-in, but you can easily write something yourself to
> monitor the sysjobs and sysdtspackages tables in the MSDB database.
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com
do I set it to ?
Thanks.WANNABE wrote:
> Hi, ya-all. That's basically my question in a nut shell. Can it, and How
> do I set it to ?
> Thanks.
>
There's nothing built-in, but you can easily write something yourself to
monitor the sysjobs and sysdtspackages tables in the MSDB database.
Tracy McKibben
MCDBA
http://www.realsqlguy.com|||Thanks Tracy, but you over estimate me!!! Although I would love to give it
a try. I have no idea where to start, could you get me started. Be advised
I will be here posting questions about how to proceed, when I become
stumped.
Does anyone know if this is a feature in SQL2005 '
"Tracy McKibben" <tracy@.realsqlguy.com> wrote in message
news:44E47FC4.7010007@.realsqlguy.com...
> WANNABE wrote:
>> Hi, ya-all. That's basically my question in a nut shell. Can it, and
>> How do I set it to ?
>> Thanks.
> There's nothing built-in, but you can easily write something yourself to
> monitor the sysjobs and sysdtspackages tables in the MSDB database.
>
> --
> Tracy McKibben
> MCDBA
> http://www.realsqlguy.com
Can SQL2000 & SQL2005 co-exist on the one server?
i realise you can have both SQL2000 & SQL2005 Client software co-existing on one (developement) machine.
but i cant seem to find a definitive answer on whether i can install both complete databases on a server?
we are currently building a new development server and would like to install both version on it if possible?
Cheers,
Craig
You can install both. You'd have to have an instance name, however.
ie. servername\sql2005
I think it's less confusing if you put both servers on separate instances..
instead of
sql2000: servername
sql2005: servername\sql2005
use
sql2000: servername\sql2000
sql2005: servername\sql2005
this way you know what environment you're pointing to..
Friday, February 10, 2012
Can not install service pack
Hi,
I have a win2k server running SQL2000. I have tried to install SP4 for SQL.
Evertything looks normal, but when I check the version it is still SP2. I
have compared the log file with another and there is a major differnce:
problem server:
09:57:26 Start Process...updating reg entries for SP
09:57:26 No Server -> Tools
Succesfully updated server:
14:46:11 Start Process...updating reg entries for SP
14:46:11 Default instance
Could this be the problem, and if so, how to solve this ?
Regards,
PanjoHi
The most common reasons for a SP not installing are either
Using the wrong download file
SQL2000-KB884525-SP4-x86-LLL.exe (Database Components SP4)
SQL2000.AS-KB884525-SP4-x86-LLL.exe (Analysis Services SP4)
SQL2000.MSDE-KB884525-SP4-x86-LLL.exe (Desktop Engine (MSDE 2000) SP4)
SQL2000-KB884525-SP4-ia64-LLL.exe (SQL Server 2000 SP4 (64-bit))
Unzipping the download but not running it
http://tinyurl.com/nbc9v
or Updating the wrong instance.
http://tinyurl.com/pmsvc
You also may want to stop/restart the server as a matter of course even if
you are not prompted to do so.
From the message it looks like SQL Server is not actually running on this
server, use NET START at a command prompt to verify this.
John
"panjo" wrote:
> Hi,
> I have a win2k server running SQL2000. I have tried to install SP4 for SQL
.
> Evertything looks normal, but when I check the version it is still SP2. I
> have compared the log file with another and there is a major differnce:
> problem server:
> 09:57:26 Start Process...updating reg entries for SP
> 09:57:26 No Server -> Tools
> Succesfully updated server:
> 14:46:11 Start Process...updating reg entries for SP
> 14:46:11 Default instance
> Could this be the problem, and if so, how to solve this ?
> Regards,
> Panjo
>|||Hi,
I am quite sure I have the right downloadfile, my testserver is updated
succesfully. There is only one instance, so I can not update the wrong one.
Using net start confirms that mssqlserver and sqlserveragent are running.
I think some reg entry's are missing or wrong. I had some problems with this
server in the past. Then I run the SQL setup again, and did a registry
rebuild. Everything is working fine after that, except that I can not instal
l
SP4.
Any idea which reg key's are checked during the install of SP4 ?
"John Bell" wrote:
[vbcol=seagreen]
> Hi
> The most common reasons for a SP not installing are either
> Using the wrong download file
> SQL2000-KB884525-SP4-x86-LLL.exe (Database Components SP4)
> SQL2000.AS-KB884525-SP4-x86-LLL.exe (Analysis Services SP4)
> SQL2000.MSDE-KB884525-SP4-x86-LLL.exe (Desktop Engine (MSDE 2000) SP4)
> SQL2000-KB884525-SP4-ia64-LLL.exe (SQL Server 2000 SP4 (64-bit))
> Unzipping the download but not running it
> http://tinyurl.com/nbc9v
> or Updating the wrong instance.
> http://tinyurl.com/pmsvc
> You also may want to stop/restart the server as a matter of course even if
> you are not prompted to do so.
> From the message it looks like SQL Server is not actually running on this
> server, use NET START at a command prompt to verify this.
> John
> "panjo" wrote:
>|||Hi
I am not sure what keys would be checked, but you may want to try another
registry rebuilt. If you have group policies being applied you may want to
check what they are doing.
John
"panjo" wrote:
[vbcol=seagreen]
> Hi,
> I am quite sure I have the right downloadfile, my testserver is updated
> succesfully. There is only one instance, so I can not update the wrong one
.
> Using net start confirms that mssqlserver and sqlserveragent are running.
> I think some reg entry's are missing or wrong. I had some problems with th
is
> server in the past. Then I run the SQL setup again, and did a registry
> rebuild. Everything is working fine after that, except that I can not inst
all
> SP4.
> Any idea which reg key's are checked during the install of SP4 ?
> "John Bell" wrote:
>
I have a win2k server running SQL2000. I have tried to install SP4 for SQL.
Evertything looks normal, but when I check the version it is still SP2. I
have compared the log file with another and there is a major differnce:
problem server:
09:57:26 Start Process...updating reg entries for SP
09:57:26 No Server -> Tools
Succesfully updated server:
14:46:11 Start Process...updating reg entries for SP
14:46:11 Default instance
Could this be the problem, and if so, how to solve this ?
Regards,
PanjoHi
The most common reasons for a SP not installing are either
Using the wrong download file
SQL2000-KB884525-SP4-x86-LLL.exe (Database Components SP4)
SQL2000.AS-KB884525-SP4-x86-LLL.exe (Analysis Services SP4)
SQL2000.MSDE-KB884525-SP4-x86-LLL.exe (Desktop Engine (MSDE 2000) SP4)
SQL2000-KB884525-SP4-ia64-LLL.exe (SQL Server 2000 SP4 (64-bit))
Unzipping the download but not running it
http://tinyurl.com/nbc9v
or Updating the wrong instance.
http://tinyurl.com/pmsvc
You also may want to stop/restart the server as a matter of course even if
you are not prompted to do so.
From the message it looks like SQL Server is not actually running on this
server, use NET START at a command prompt to verify this.
John
"panjo" wrote:
> Hi,
> I have a win2k server running SQL2000. I have tried to install SP4 for SQL
.
> Evertything looks normal, but when I check the version it is still SP2. I
> have compared the log file with another and there is a major differnce:
> problem server:
> 09:57:26 Start Process...updating reg entries for SP
> 09:57:26 No Server -> Tools
> Succesfully updated server:
> 14:46:11 Start Process...updating reg entries for SP
> 14:46:11 Default instance
> Could this be the problem, and if so, how to solve this ?
> Regards,
> Panjo
>|||Hi,
I am quite sure I have the right downloadfile, my testserver is updated
succesfully. There is only one instance, so I can not update the wrong one.
Using net start confirms that mssqlserver and sqlserveragent are running.
I think some reg entry's are missing or wrong. I had some problems with this
server in the past. Then I run the SQL setup again, and did a registry
rebuild. Everything is working fine after that, except that I can not instal
l
SP4.
Any idea which reg key's are checked during the install of SP4 ?
"John Bell" wrote:
[vbcol=seagreen]
> Hi
> The most common reasons for a SP not installing are either
> Using the wrong download file
> SQL2000-KB884525-SP4-x86-LLL.exe (Database Components SP4)
> SQL2000.AS-KB884525-SP4-x86-LLL.exe (Analysis Services SP4)
> SQL2000.MSDE-KB884525-SP4-x86-LLL.exe (Desktop Engine (MSDE 2000) SP4)
> SQL2000-KB884525-SP4-ia64-LLL.exe (SQL Server 2000 SP4 (64-bit))
> Unzipping the download but not running it
> http://tinyurl.com/nbc9v
> or Updating the wrong instance.
> http://tinyurl.com/pmsvc
> You also may want to stop/restart the server as a matter of course even if
> you are not prompted to do so.
> From the message it looks like SQL Server is not actually running on this
> server, use NET START at a command prompt to verify this.
> John
> "panjo" wrote:
>|||Hi
I am not sure what keys would be checked, but you may want to try another
registry rebuilt. If you have group policies being applied you may want to
check what they are doing.
John
"panjo" wrote:
[vbcol=seagreen]
> Hi,
> I am quite sure I have the right downloadfile, my testserver is updated
> succesfully. There is only one instance, so I can not update the wrong one
.
> Using net start confirms that mssqlserver and sqlserveragent are running.
> I think some reg entry's are missing or wrong. I had some problems with th
is
> server in the past. Then I run the SQL setup again, and did a registry
> rebuild. Everything is working fine after that, except that I can not inst
all
> SP4.
> Any idea which reg key's are checked during the install of SP4 ?
> "John Bell" wrote:
>
Can not install service pack
Hi,
I have a win2k server running SQL2000. I have tried to install SP4 for SQL.
Evertything looks normal, but when I check the version it is still SP2. I
have compared the log file with another and there is a major differnce:
problem server:
09:57:26 Start Process...updating reg entries for SP
09:57:26 No Server -> Tools
Succesfully updated server:
14:46:11 Start Process...updating reg entries for SP
14:46:11 Default instance
Could this be the problem, and if so, how to solve this ?
Regards,
PanjoHi
The most common reasons for a SP not installing are either
Using the wrong download file
SQL2000-KB884525-SP4-x86-LLL.exe (Database Components SP4)
SQL2000.AS-KB884525-SP4-x86-LLL.exe (Analysis Services SP4)
SQL2000.MSDE-KB884525-SP4-x86-LLL.exe (Desktop Engine (MSDE 2000) SP4)
SQL2000-KB884525-SP4-ia64-LLL.exe (SQL Server 2000 SP4 (64-bit))
Unzipping the download but not running it
http://tinyurl.com/nbc9v
or Updating the wrong instance.
http://tinyurl.com/pmsvc
You also may want to stop/restart the server as a matter of course even if
you are not prompted to do so.
From the message it looks like SQL Server is not actually running on this
server, use NET START at a command prompt to verify this.
John
"panjo" wrote:
> Hi,
> I have a win2k server running SQL2000. I have tried to install SP4 for SQL.
> Evertything looks normal, but when I check the version it is still SP2. I
> have compared the log file with another and there is a major differnce:
> problem server:
> 09:57:26 Start Process...updating reg entries for SP
> 09:57:26 No Server -> Tools
> Succesfully updated server:
> 14:46:11 Start Process...updating reg entries for SP
> 14:46:11 Default instance
> Could this be the problem, and if so, how to solve this ?
> Regards,
> Panjo
>|||Hi,
I am quite sure I have the right downloadfile, my testserver is updated
succesfully. There is only one instance, so I can not update the wrong one.
Using net start confirms that mssqlserver and sqlserveragent are running.
I think some reg entry's are missing or wrong. I had some problems with this
server in the past. Then I run the SQL setup again, and did a registry
rebuild. Everything is working fine after that, except that I can not install
SP4.
Any idea which reg key's are checked during the install of SP4 ?
"John Bell" wrote:
> Hi
> The most common reasons for a SP not installing are either
> Using the wrong download file
> SQL2000-KB884525-SP4-x86-LLL.exe (Database Components SP4)
> SQL2000.AS-KB884525-SP4-x86-LLL.exe (Analysis Services SP4)
> SQL2000.MSDE-KB884525-SP4-x86-LLL.exe (Desktop Engine (MSDE 2000) SP4)
> SQL2000-KB884525-SP4-ia64-LLL.exe (SQL Server 2000 SP4 (64-bit))
> Unzipping the download but not running it
> http://tinyurl.com/nbc9v
> or Updating the wrong instance.
> http://tinyurl.com/pmsvc
> You also may want to stop/restart the server as a matter of course even if
> you are not prompted to do so.
> From the message it looks like SQL Server is not actually running on this
> server, use NET START at a command prompt to verify this.
> John
> "panjo" wrote:
> > Hi,
> >
> > I have a win2k server running SQL2000. I have tried to install SP4 for SQL.
> > Evertything looks normal, but when I check the version it is still SP2. I
> > have compared the log file with another and there is a major differnce:
> >
> > problem server:
> > 09:57:26 Start Process...updating reg entries for SP
> > 09:57:26 No Server -> Tools
> >
> > Succesfully updated server:
> > 14:46:11 Start Process...updating reg entries for SP
> > 14:46:11 Default instance
> >
> > Could this be the problem, and if so, how to solve this ?
> >
> > Regards,
> > Panjo
> >
> >|||Hi
I am not sure what keys would be checked, but you may want to try another
registry rebuilt. If you have group policies being applied you may want to
check what they are doing.
John
"panjo" wrote:
> Hi,
> I am quite sure I have the right downloadfile, my testserver is updated
> succesfully. There is only one instance, so I can not update the wrong one.
> Using net start confirms that mssqlserver and sqlserveragent are running.
> I think some reg entry's are missing or wrong. I had some problems with this
> server in the past. Then I run the SQL setup again, and did a registry
> rebuild. Everything is working fine after that, except that I can not install
> SP4.
> Any idea which reg key's are checked during the install of SP4 ?
> "John Bell" wrote:
> > Hi
> >
> > The most common reasons for a SP not installing are either
> >
> > Using the wrong download file
> > SQL2000-KB884525-SP4-x86-LLL.exe (Database Components SP4)
> > SQL2000.AS-KB884525-SP4-x86-LLL.exe (Analysis Services SP4)
> > SQL2000.MSDE-KB884525-SP4-x86-LLL.exe (Desktop Engine (MSDE 2000) SP4)
> > SQL2000-KB884525-SP4-ia64-LLL.exe (SQL Server 2000 SP4 (64-bit))
> >
> > Unzipping the download but not running it
> > http://tinyurl.com/nbc9v
> >
> > or Updating the wrong instance.
> > http://tinyurl.com/pmsvc
> >
> > You also may want to stop/restart the server as a matter of course even if
> > you are not prompted to do so.
> >
> > From the message it looks like SQL Server is not actually running on this
> > server, use NET START at a command prompt to verify this.
> >
> > John
> >
> > "panjo" wrote:
> >
> > > Hi,
> > >
> > > I have a win2k server running SQL2000. I have tried to install SP4 for SQL.
> > > Evertything looks normal, but when I check the version it is still SP2. I
> > > have compared the log file with another and there is a major differnce:
> > >
> > > problem server:
> > > 09:57:26 Start Process...updating reg entries for SP
> > > 09:57:26 No Server -> Tools
> > >
> > > Succesfully updated server:
> > > 14:46:11 Start Process...updating reg entries for SP
> > > 14:46:11 Default instance
> > >
> > > Could this be the problem, and if so, how to solve this ?
> > >
> > > Regards,
> > > Panjo
> > >
> > >
I have a win2k server running SQL2000. I have tried to install SP4 for SQL.
Evertything looks normal, but when I check the version it is still SP2. I
have compared the log file with another and there is a major differnce:
problem server:
09:57:26 Start Process...updating reg entries for SP
09:57:26 No Server -> Tools
Succesfully updated server:
14:46:11 Start Process...updating reg entries for SP
14:46:11 Default instance
Could this be the problem, and if so, how to solve this ?
Regards,
PanjoHi
The most common reasons for a SP not installing are either
Using the wrong download file
SQL2000-KB884525-SP4-x86-LLL.exe (Database Components SP4)
SQL2000.AS-KB884525-SP4-x86-LLL.exe (Analysis Services SP4)
SQL2000.MSDE-KB884525-SP4-x86-LLL.exe (Desktop Engine (MSDE 2000) SP4)
SQL2000-KB884525-SP4-ia64-LLL.exe (SQL Server 2000 SP4 (64-bit))
Unzipping the download but not running it
http://tinyurl.com/nbc9v
or Updating the wrong instance.
http://tinyurl.com/pmsvc
You also may want to stop/restart the server as a matter of course even if
you are not prompted to do so.
From the message it looks like SQL Server is not actually running on this
server, use NET START at a command prompt to verify this.
John
"panjo" wrote:
> Hi,
> I have a win2k server running SQL2000. I have tried to install SP4 for SQL.
> Evertything looks normal, but when I check the version it is still SP2. I
> have compared the log file with another and there is a major differnce:
> problem server:
> 09:57:26 Start Process...updating reg entries for SP
> 09:57:26 No Server -> Tools
> Succesfully updated server:
> 14:46:11 Start Process...updating reg entries for SP
> 14:46:11 Default instance
> Could this be the problem, and if so, how to solve this ?
> Regards,
> Panjo
>|||Hi,
I am quite sure I have the right downloadfile, my testserver is updated
succesfully. There is only one instance, so I can not update the wrong one.
Using net start confirms that mssqlserver and sqlserveragent are running.
I think some reg entry's are missing or wrong. I had some problems with this
server in the past. Then I run the SQL setup again, and did a registry
rebuild. Everything is working fine after that, except that I can not install
SP4.
Any idea which reg key's are checked during the install of SP4 ?
"John Bell" wrote:
> Hi
> The most common reasons for a SP not installing are either
> Using the wrong download file
> SQL2000-KB884525-SP4-x86-LLL.exe (Database Components SP4)
> SQL2000.AS-KB884525-SP4-x86-LLL.exe (Analysis Services SP4)
> SQL2000.MSDE-KB884525-SP4-x86-LLL.exe (Desktop Engine (MSDE 2000) SP4)
> SQL2000-KB884525-SP4-ia64-LLL.exe (SQL Server 2000 SP4 (64-bit))
> Unzipping the download but not running it
> http://tinyurl.com/nbc9v
> or Updating the wrong instance.
> http://tinyurl.com/pmsvc
> You also may want to stop/restart the server as a matter of course even if
> you are not prompted to do so.
> From the message it looks like SQL Server is not actually running on this
> server, use NET START at a command prompt to verify this.
> John
> "panjo" wrote:
> > Hi,
> >
> > I have a win2k server running SQL2000. I have tried to install SP4 for SQL.
> > Evertything looks normal, but when I check the version it is still SP2. I
> > have compared the log file with another and there is a major differnce:
> >
> > problem server:
> > 09:57:26 Start Process...updating reg entries for SP
> > 09:57:26 No Server -> Tools
> >
> > Succesfully updated server:
> > 14:46:11 Start Process...updating reg entries for SP
> > 14:46:11 Default instance
> >
> > Could this be the problem, and if so, how to solve this ?
> >
> > Regards,
> > Panjo
> >
> >|||Hi
I am not sure what keys would be checked, but you may want to try another
registry rebuilt. If you have group policies being applied you may want to
check what they are doing.
John
"panjo" wrote:
> Hi,
> I am quite sure I have the right downloadfile, my testserver is updated
> succesfully. There is only one instance, so I can not update the wrong one.
> Using net start confirms that mssqlserver and sqlserveragent are running.
> I think some reg entry's are missing or wrong. I had some problems with this
> server in the past. Then I run the SQL setup again, and did a registry
> rebuild. Everything is working fine after that, except that I can not install
> SP4.
> Any idea which reg key's are checked during the install of SP4 ?
> "John Bell" wrote:
> > Hi
> >
> > The most common reasons for a SP not installing are either
> >
> > Using the wrong download file
> > SQL2000-KB884525-SP4-x86-LLL.exe (Database Components SP4)
> > SQL2000.AS-KB884525-SP4-x86-LLL.exe (Analysis Services SP4)
> > SQL2000.MSDE-KB884525-SP4-x86-LLL.exe (Desktop Engine (MSDE 2000) SP4)
> > SQL2000-KB884525-SP4-ia64-LLL.exe (SQL Server 2000 SP4 (64-bit))
> >
> > Unzipping the download but not running it
> > http://tinyurl.com/nbc9v
> >
> > or Updating the wrong instance.
> > http://tinyurl.com/pmsvc
> >
> > You also may want to stop/restart the server as a matter of course even if
> > you are not prompted to do so.
> >
> > From the message it looks like SQL Server is not actually running on this
> > server, use NET START at a command prompt to verify this.
> >
> > John
> >
> > "panjo" wrote:
> >
> > > Hi,
> > >
> > > I have a win2k server running SQL2000. I have tried to install SP4 for SQL.
> > > Evertything looks normal, but when I check the version it is still SP2. I
> > > have compared the log file with another and there is a major differnce:
> > >
> > > problem server:
> > > 09:57:26 Start Process...updating reg entries for SP
> > > 09:57:26 No Server -> Tools
> > >
> > > Succesfully updated server:
> > > 14:46:11 Start Process...updating reg entries for SP
> > > 14:46:11 Default instance
> > >
> > > Could this be the problem, and if so, how to solve this ?
> > >
> > > Regards,
> > > Panjo
> > >
> > >
Subscribe to:
Posts (Atom)