Showing posts with label generated. Show all posts
Showing posts with label generated. Show all posts

Tuesday, February 14, 2012

Convert from SQL 6.0 to SQL 7.0

Hi all,
I have a database backup file (backup.dat) generated by SQL server 6.0.
Now I want to restore it to a SQl server 7.0.
How can I do it.
Thx.Hi,
No, You cant restore the SQL 6.0 backup file to SQL 7 or SQL 2000. This is
due to architectural changes.
Only way to copy SQL 6.0 daa to SQL 7.0 is upgrade using Upgrade wizard
coming with SQL 7.0, this require SQL 6.0 server to be up and running
Upgrade steps:
1. You'll have to have the SQL 6.0 with the database online
2. Install SQL 7 and the latest SP
3. Once your both servers (6.0 and 7.) are both running
4. Run the upgrade wizard in SQL 7.0 (Coming along with SQL7)
5. This will upgrade sql 6.0 to sql 7.0 and keep the sql 6.0 database safe.
6. Using switch option you can move between sql 6.0 and sql 7.0
Setup the test environment first, this will also give you practice on how to
migrate.
Thanks
Hari
MCDBA
"abc" <abc@.abc.com> wrote in message
news:#6QdkrvEEHA.4080@.TK2MSFTNGP09.phx.gbl...
> Hi all,
> I have a database backup file (backup.dat) generated by SQL server 6.0.
> Now I want to restore it to a SQl server 7.0.
> How can I do it.
> Thx.
>|||Thx for your kindly answer.
"Hari" <hari_prasad_k@.hotmail.com> wrote in message
news:uS5Gw6vEEHA.2416@.TK2MSFTNGP12.phx.gbl...
> Hi,
> No, You cant restore the SQL 6.0 backup file to SQL 7 or SQL 2000. This is
> due to architectural changes.
> Only way to copy SQL 6.0 daa to SQL 7.0 is upgrade using Upgrade wizard
> coming with SQL 7.0, this require SQL 6.0 server to be up and running
> Upgrade steps:
> 1. You'll have to have the SQL 6.0 with the database online
> 2. Install SQL 7 and the latest SP
> 3. Once your both servers (6.0 and 7.) are both running
> 4. Run the upgrade wizard in SQL 7.0 (Coming along with SQL7)
> 5. This will upgrade sql 6.0 to sql 7.0 and keep the sql 6.0 database
safe.
> 6. Using switch option you can move between sql 6.0 and sql 7.0
> Setup the test environment first, this will also give you practice on how
to
> migrate.
> Thanks
> Hari
> MCDBA
>
>
> "abc" <abc@.abc.com> wrote in message
> news:#6QdkrvEEHA.4080@.TK2MSFTNGP09.phx.gbl...
>

Sunday, February 12, 2012

convert dynamically generated parameters list into stored proc

I have the following ASP code that builds part of the example SQL statement below (it's the same SQL as in my earlier thread here (http://www.dbforums.com/showthread.php?t=1214044) but a very different question):

if sFindTicketEventId > 0 then sSQL = sSQL & " AND [tblEvents].[id]=" & sFindTicketEventId
if sFindTicketStandId > 0 then sSQL = sSQL & " AND [tblStands].[id]=" & sFindTicketStandId

SELECT
[tblC].[id] AS CombinationID,
[tblC].[availability],
[tblC].[description],
[tblC].[price] AS combinationPrice,
[tblC].[combination_open],
[tblT].[TicketID] AS TicketID,
[tblT].[price] AS ticketPrice,
[tblT].[availability],
[tblT].[ticket_open],
[tblT].[quantity],
[tblT].[event_name],
[tblT].[event_open],
[tblT].[stand_name],
[tblT].[stand_open],
[tblT].[admission_start_date],
[tblT].[admission_end_date],
[tblT].[date_open],
[tblT].,
[tblT].,
[tblT2].[description],
[tblT2].[admin_description]
FROM(
SELECT
[tblCombinations].[id],
[tblTickets].[id] As TicketID, [tblTickets].[price], [tblTickets].[availability], [tblTickets].[ticket_open],
[tblCombinations_Tickets].[quantity],
[tblEvents].[event_name],
[tblEvents].[event_open],
[tblStands].[stand_name],
[tblStands].[stand_open],
[tblAdmissionDates].[admission_start_date],
[tblAdmissionDates].[admission_end_date],
[tblAdmissionDates].[date_open],
[tblBookingDates].[booking_start_date],
[tblBookingDates].[booking_end_date]
FROM [tblCombinations]
LEFT JOIN [tblCombinations_Tickets] ON [tblCombinations_Tickets].[combination_id] = [tblCombinations].[id]
LEFT JOIN [tblTickets] ON [tblCombinations_Tickets].[ticket_id] = [tblTickets].[id]
LEFT JOIN [tblEvents] ON [tblEvents].[id] = [tblTickets].[event_id]
LEFT JOIN [tblStands] ON [tblStands].[id] = [tblTickets].[stand_id]
LEFT JOIN [tblAdmissionDates] ON [tblAdmissionDates].[id] = [tblTickets].[admission_date_id]
LEFT JOIN [tblBookingDates] ON [tblBookingDates].[id] = [tblTickets].[booking_date_id]
LEFT JOIN [tblTicketConcessions] ON [tblTicketConcessions].[id] = [tblTickets].[ticket_concession_id]
LEFT JOIN [tblBookingQuantities] AS [tblBookingMinQuantities] ON [tblBookingMinQuantities].[id] = [tblTickets].[booking_min_quantity_id]
LEFT JOIN [tblBookingQuantities] AS [tblBookingMaxQuantities] ON [tblBookingMaxQuantities].[id] = [tblTickets].[booking_max_quantity_id]
LEFT JOIN [tblMemberships] ON [tblMemberships].[id] = [tblTickets].[membership_id]
WHERE 1=1
[B]AND [tblEvents].[id]=2
[B]AND [tblStands].[id]=3
--AND [tblAdmissionDates].[id]=@.admissionDateId
--AND [tblBookingDates].[id]=@.bookingDateId
--AND [tblTicketConcessions].[id]=@.concessionId
--AND [tblBookingMinQuantities].[id]=@.bookingMinQuantityId
--AND [tblBookingMaxQuantities].[id]=@.bookingMaxQuantityId
--AND [tblMemberships].[id]=@.membershipId
GROUP BY
[tblCombinations].[id],
[tblTickets].[id],
[tblTickets].[price], [tblTickets].[availability], [tblTickets].[ticket_open],
[tblCombinations_Tickets].[quantity],
[tblEvents].[event_name],
[tblEvents].[event_open],
[tblStands].[stand_name],
[tblStands].[stand_open],
[tblAdmissionDates].[admission_start_date],
[tblAdmissionDates].[admission_end_date],
[tblAdmissionDates].[date_open],
[tblBookingDates].[booking_start_date],
[tblBookingDates].[booking_end_date]
) as [tblT]
JOIN [tblCombinations] as [tblC] on [tblT].[id]=[tblC].[id]
LEFT JOIN [tblTickets] as [tblT2] on [tblT].[TicketID]=[tblT2].[id]

I want to turn this SQL into a stored proc; there are currently about 8 parameters that I want to pass into it. The field value for each will be either NULL or a positive integer, and the paramater will be passed in as an integer.

If the passed parameter value is a positive integer then it should return all records where the corresponding field value matches that integer. If the passed parameter is 0, it should return all rows regardless of whether the field value is an integer or NULL.

And I can't for the life of me figure out how to do it. Do I need an IF statement in there or something?

:confused:Hi
A common method is:
WHERE (MyField = @.MyParam OR @.MyParam = 0)
I read an article somewhere though that poohed poohed this as the optimiser can't use the index or something though.|||Well, seeing as my state of blissful ignorance safely censored your "optimiser" comment, I can happily report that the solution works great :) Thanks.

Friday, February 10, 2012

Convert database from sql 2005 to sql 2000

Hi,

Can anybody tell me that how to convert database from sql server 2005 to sql server 2000. I tried with generated script and in that i selected the option for sql server 2000 but still while trying to run that script it is throwing an error. the error is:

Server: Msg 170, Level 15, State 1, Line 11
Line 11: Incorrect syntax near '('.
Server: Msg 170, Level 15, State 1, Line 8
Line 8: Incorrect syntax near '('.
Server: Msg 170, Level 15, State 1, Line 11
Line 11: Incorrect syntax near '('.
Server: Msg 170, Level 15, State 1, Line 8
Line 8: Incorrect syntax near '('.

plz help.

Thanks,

Poonam

Hi,

which service Pack are you using, there had been issues in the RTM built which were fixed in SP1. (Unfortunately I can′t remember any details about that). Could you please post the non-working snippet here ? If you are not sure where the error occurs (as the parser will begin the new numbering after each GO statement), try to execute the script step-by-Step to narrow down the problem.

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de