Showing posts with label created. Show all posts
Showing posts with label created. Show all posts

Thursday, March 29, 2012

Database Connection

Still new here, please be gentle.

I created a database inside SQL. I made my tables,etc.

When I try to connect to it from VBE I cannot open it!

I get an error stating that I cannot connect to it.

Am I doing the right thing?

If I create an SQL db from within VBE, I run into issues. I would rather not install the db's into my project since this will be a shared app.

Could some give me a little advice or point me in the right direction, please.

Davids Learning

IF I HAD ONLY TOOK ABOUT 8 HOURS

I COULD HAVE SOLVE MY OWN PROBLEM

READ BLOGS MORE

Davids Learning

Database compatibility between MSDE and SQL Server 2000

I have a database that was created in SQL Server 2000. Would there be any
issues if I used this database in MSDE? Does anyone know of any document
regarding this? All the articles I have read talk about MSDE databases being
compatible with SQL Server 2000. None of them discussed the reverse case.
Thanks in advance!
hi Anushree,
"Anushree Laturkar" <anushree.laturkar@.bindview.com> ha scritto nel
messaggio news:%23WE5kkx7EHA.3504@.TK2MSFTNGP12.phx.gbl
> I have a database that was created in SQL Server 2000. Would there be
> any issues if I used this database in MSDE? Does anyone know of any
> document regarding this? All the articles I have read talk about MSDE
> databases being compatible with SQL Server 2000. None of them
> discussed the reverse case.
> Thanks in advance!
MSDE 2000 and SQL Server 2000 databases are compatible as the engine is the
same.. MSDE only has "added" features in the Storage Engine regarding checks
for datab files not exceeding 2gb upper limit
but the core architechture is the same, so you can move users SQL Server
2000 databases to MSDE 2000 and vice versa..
the same applied service pack level is appreciated
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtmhttp://italy.mvps.org
DbaMgr2k ver 0.9.1 - DbaMgr ver 0.55.1
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
-- remove DMO to reply

Database compatibility between MSDE and SQL Server 2000

I have a database that was created in SQL Server 2000. Would there be any
issues if I used this database in MSDE? Does anyone know of any document
regarding this? All the articles I have read talk about MSDE databases being
compatible with SQL Server 2000. None of them discussed the reverse case.
Thanks in advance!MSDE and SQL Server is the same. There are some features not available on MSDE, but I doubt you will
run into them...
http://msdn.microsoft.com/library/en-us/architec/8_ar_ts_1cdv.asp
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
http://www.sqlug.se/
"Anushree Laturkar" <anushree.laturkar@.bindview.com> wrote in message
news:ubDnKkx7EHA.2608@.TK2MSFTNGP10.phx.gbl...
>I have a database that was created in SQL Server 2000. Would there be any
> issues if I used this database in MSDE? Does anyone know of any document
> regarding this? All the articles I have read talk about MSDE databases being
> compatible with SQL Server 2000. None of them discussed the reverse case.
> Thanks in advance!
>|||As long as you are talking about MSDE 2.0, not the MSDE 1.0 that came out
with SS 7.0.
Out of curiosity, why would you want to revert back like this? If you are
looking at a development platform, why not deploy SS Developer Edition.
Microsoft has recently dropped the price on this edition down to $50 and you
get the full Enterprise Edition for development purposes without any sort of
throttles or restrictions.
Sincerely,
Anthony Thomas
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:%23tq6A8y7EHA.3236@.TK2MSFTNGP15.phx.gbl...
MSDE and SQL Server is the same. There are some features not available on
MSDE, but I doubt you will
run into them...
http://msdn.microsoft.com/library/en-us/architec/8_ar_ts_1cdv.asp
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
http://www.sqlug.se/
"Anushree Laturkar" <anushree.laturkar@.bindview.com> wrote in message
news:ubDnKkx7EHA.2608@.TK2MSFTNGP10.phx.gbl...
>I have a database that was created in SQL Server 2000. Would there be any
> issues if I used this database in MSDE? Does anyone know of any document
> regarding this? All the articles I have read talk about MSDE databases
being
> compatible with SQL Server 2000. None of them discussed the reverse case.
> Thanks in advance!
>sql

Database compatibility between MSDE and SQL Server 2000

I have a database that was created in SQL Server 2000. Would there be any
issues if I used this database in MSDE? Does anyone know of any document
regarding this? All the articles I have read talk about MSDE databases being
compatible with SQL Server 2000. None of them discussed the reverse case.
Thanks in advance!
MSDE and SQL Server is the same. There are some features not available on MSDE, but I doubt you will
run into them...
http://msdn.microsoft.com/library/en...ar_ts_1cdv.asp
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
http://www.sqlug.se/
"Anushree Laturkar" <anushree.laturkar@.bindview.com> wrote in message
news:ubDnKkx7EHA.2608@.TK2MSFTNGP10.phx.gbl...
>I have a database that was created in SQL Server 2000. Would there be any
> issues if I used this database in MSDE? Does anyone know of any document
> regarding this? All the articles I have read talk about MSDE databases being
> compatible with SQL Server 2000. None of them discussed the reverse case.
> Thanks in advance!
>
|||As long as you are talking about MSDE 2.0, not the MSDE 1.0 that came out
with SS 7.0.
Out of curiosity, why would you want to revert back like this? If you are
looking at a development platform, why not deploy SS Developer Edition.
Microsoft has recently dropped the price on this edition down to $50 and you
get the full Enterprise Edition for development purposes without any sort of
throttles or restrictions.
Sincerely,
Anthony Thomas

"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:%23tq6A8y7EHA.3236@.TK2MSFTNGP15.phx.gbl...
MSDE and SQL Server is the same. There are some features not available on
MSDE, but I doubt you will
run into them...
http://msdn.microsoft.com/library/en...ar_ts_1cdv.asp
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
http://www.sqlug.se/
"Anushree Laturkar" <anushree.laturkar@.bindview.com> wrote in message
news:ubDnKkx7EHA.2608@.TK2MSFTNGP10.phx.gbl...
>I have a database that was created in SQL Server 2000. Would there be any
> issues if I used this database in MSDE? Does anyone know of any document
> regarding this? All the articles I have read talk about MSDE databases
being
> compatible with SQL Server 2000. None of them discussed the reverse case.
> Thanks in advance!
>

Database compatibility between MSDE and SQL Server 2000

I have a database that was created in SQL Server 2000. Would there be any
issues if I used this database in MSDE? Does anyone know of any document
regarding this? All the articles I have read talk about MSDE databases being
compatible with SQL Server 2000. None of them discussed the reverse case.
Thanks in advance!MSDE and SQL Server is the same. There are some features not available on MS
DE, but I doubt you will
run into them...
http://msdn.microsoft.com/library/e..._ar_ts_1cdv.asp
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
http://www.sqlug.se/
"Anushree Laturkar" <anushree.laturkar@.bindview.com> wrote in message
news:ubDnKkx7EHA.2608@.TK2MSFTNGP10.phx.gbl...
>I have a database that was created in SQL Server 2000. Would there be any
> issues if I used this database in MSDE? Does anyone know of any document
> regarding this? All the articles I have read talk about MSDE databases bei
ng
> compatible with SQL Server 2000. None of them discussed the reverse case.
> Thanks in advance!
>|||As long as you are talking about MSDE 2.0, not the MSDE 1.0 that came out
with SS 7.0.
Out of curiosity, why would you want to revert back like this? If you are
looking at a development platform, why not deploy SS Developer Edition.
Microsoft has recently dropped the price on this edition down to $50 and you
get the full Enterprise Edition for development purposes without any sort of
throttles or restrictions.
Sincerely,
Anthony Thomas
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:%23tq6A8y7EHA.3236@.TK2MSFTNGP15.phx.gbl...
MSDE and SQL Server is the same. There are some features not available on
MSDE, but I doubt you will
run into them...
http://msdn.microsoft.com/library/e..._ar_ts_1cdv.asp
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
http://www.sqlug.se/
"Anushree Laturkar" <anushree.laturkar@.bindview.com> wrote in message
news:ubDnKkx7EHA.2608@.TK2MSFTNGP10.phx.gbl...
>I have a database that was created in SQL Server 2000. Would there be any
> issues if I used this database in MSDE? Does anyone know of any document
> regarding this? All the articles I have read talk about MSDE databases
being
> compatible with SQL Server 2000. None of them discussed the reverse case.
> Thanks in advance!
>

Database compare

Hi,
I am a novice server 2000 guy. I have two databases running under one
server. One is in production and another one was created by my
predecessor to retire production database and he might have added some
extra tables and fields in the new database. My job is to make sure
that whatever in the current production database is in the new
database. How can I compare the tables and if any data doesn't match
print that raw?
I tried few select ...join but did not work...
Thank you in advance...
ChorI would just like to elaborate more on my quetion...
let's say I have two identical tables with different data...
pubs.dbo.authors has 23 records
tempdb.dbo.authors has 20 records
I want to see the difference. Hope this make sense|||3rd party tool. SQL Compare by RedGate. Free 30 day
trial...www.red-gate.com
HTH. Ryan
"Hitesh Joshi" <hitesh287@.gmail.com> wrote in message
news:1147788619.613730.8390@.j33g2000cwa.googlegroups.com...
> Hi,
> I am a novice server 2000 guy. I have two databases running under one
> server. One is in production and another one was created by my
> predecessor to retire production database and he might have added some
> extra tables and fields in the new database. My job is to make sure
> that whatever in the current production database is in the new
> database. How can I compare the tables and if any data doesn't match
> print that raw?
> I tried few select ...join but did not work...
> Thank you in advance...
> Chor
>|||1 way would be :-
SELECT * FROM pubs.dbo.authors where UniqueID NOT IN (SELECT UniqueID FROM
tempdb.dbo.authors)
There are far more elaborate solutions and i'm sure i'll get flamed for
using NOT IN rather than EXISTS...
HTH. Ryan
"Hitesh Joshi" <hitesh287@.gmail.com> wrote in message
news:1147791030.151031.288430@.u72g2000cwu.googlegroups.com...
>I would just like to elaborate more on my quetion...
> let's say I have two identical tables with different data...
> pubs.dbo.authors has 23 records
> tempdb.dbo.authors has 20 records
> I want to see the difference. Hope this make sense
>|||SELECT a.ID, a.CheckSum
>From (Select au_id as "ID", BINARY_CHECKSUM(*) as "CheckSum"
FROM pubs.dbo.authors ) a
Inner Join (
Select au_id as "ID", BINARY_CHECKSUM(*) as "CheckSum"
FROM tempdb.dbo.authors ) b
On a.ID = b.ID
Where a.CheckSum != b.CheckSum
I tried this query but it doesn't return last three missing records(I
deleted those records from tempdb.dbo.rad_oltp to check if they come
from pubs.dbo.authors table up) ... but nothing returned...|||here are 3 more ways
select * from tempdb..authors t2 right join pubs..authors t1 on
t1.au_id =t2.au_id
where t2.au_id is null
select * from pubs..authors t1 left join tempdb..authors t2 on
t1.au_id =t2.au_id
where t2.au_id is null
select * from pubs..authors t1 where not exists(select * from
tempdb..authors where t1.au_id =au_id)
Denis the SQL Menace
http://sqlservercode.blogspot.com/|||SELECT a.ID, a.CheckSum

>From (Select au_id as "ID", BINARY_CHECKSUM(*) as "CheckSum"
FROM pubs.dbo.authors ) a
Inner Join (
Select au_id as "ID", BINARY_CHECKSUM(*) as "CheckSum"
FROM tempdb.dbo.authors ) b
On a.ID = b.ID
Where a.CheckSum != b.CheckSum
I tried this query but it doesn't return last three missing records(I
deleted those records from tempdb.dbo.rad_oltp to check if they come
from pubs.dbo.authors table up) ... but nothing returned...
My mistake.. there is a typo .. it is tempdb.dbo.authors|||Here we go
--Not in Pubs
select 'DoesNotExistOnProduction',t2.au_id from pubs..authors t1
right join tempdb..authors t2 on t1.au_id =t2.au_id
where t1.au_id is null
union all
--Not in Temp
select 'DoesNotExistInStaging',t1.au_id from pubs..authors t1 left
join tempdb..authors t2 on t1.au_id =t2.au_id
where t2.au_id is null
union all
--Data Mismatch
select 'DataMismatch', t1.au_id from( select BINARY_CHECKSUM(*) as
CheckSum1 ,au_id from pubs..authors) t1
join(
select BINARY_CHECKSUM(*) as CheckSum2,au_id from tempdb..authors) t2
on t1.au_id =t2.au_id
Where CheckSum1 <> CheckSum2
Here is the complete script that I used to create the authors2 table
and modify/add records to test
--let's copy over 20 rows to a table named authors2
select top 20 * into tempdb..authors2 from pubs..authors
--update 5 records by appending X to the au_fnam
set rowcount 5
update tempdb..authors2
set au_fname =au_fname +'X'
set rowcount 0
--let's insert a row that doesn't exist in pubs
insert into tempdb..authors2
select '666-66-6666', au_lname, au_fname, phone, address, city, state,
zip, contract
from tempdb..authors2
where au_id ='172-32-1176'
--The BIG SELECT
--Not in Pubs
select 'DoesNotExistOnProduction',t2.au_id from pubs..authors t1
right join tempdb..authors2 t2 on t1.au_id =t2.au_id
where t1.au_id is null
union all
--Not in Temp
select 'DoesNotExistInStaging',t1.au_id from pubs..authors t1 left
join tempdb..authors2 t2 on t1.au_id =t2.au_id
where t2.au_id is null
union all
--Data Mismatch
select 'DataMismatch', t1.au_id from( select BINARY_CHECKSUM(*) as
CheckSum1 ,au_id from pubs..authors) t1
join(
select BINARY_CHECKSUM(*) as CheckSum2,au_id from tempdb..authors2) t2
on t1.au_id =t2.au_id
Where CheckSum1 <> CheckSum2
Denis the SQL Menace
http://sqlservercode.blogspot.com/|||Thank you so much.. that worked!!
You made my day|||No problem
Denis the SQL Menace
http://sqlservercode.blogspot.com/

Tuesday, March 27, 2012

Database compare

Hi,
I am a novice server 2000 guy. I have two databases running under one
server. One is in production and another one was created by my
predecessor to retire production database and he might have added some
extra tables and fields in the new database. My job is to make sure
that whatever in the current production database is in the new
database. How can I compare the tables and if any data doesn't match
print that raw?
I tried few select ...join but did not work...
Thank you in advance...
ChorI would just like to elaborate more on my quetion...
let's say I have two identical tables with different data...
pubs.dbo.authors has 23 records
tempdb.dbo.authors has 20 records
I want to see the difference. Hope this make sense|||3rd party tool. SQL Compare by RedGate. Free 30 day
trial...www.red-gate.com
--
HTH. Ryan
"Hitesh Joshi" <hitesh287@.gmail.com> wrote in message
news:1147788619.613730.8390@.j33g2000cwa.googlegroups.com...
> Hi,
> I am a novice server 2000 guy. I have two databases running under one
> server. One is in production and another one was created by my
> predecessor to retire production database and he might have added some
> extra tables and fields in the new database. My job is to make sure
> that whatever in the current production database is in the new
> database. How can I compare the tables and if any data doesn't match
> print that raw?
> I tried few select ...join but did not work...
> Thank you in advance...
> Chor
>|||1 way would be :-
SELECT * FROM pubs.dbo.authors where UniqueID NOT IN (SELECT UniqueID FROM
tempdb.dbo.authors)
There are far more elaborate solutions and i'm sure i'll get flamed for
using NOT IN rather than EXISTS...
--
HTH. Ryan
"Hitesh Joshi" <hitesh287@.gmail.com> wrote in message
news:1147791030.151031.288430@.u72g2000cwu.googlegroups.com...
>I would just like to elaborate more on my quetion...
> let's say I have two identical tables with different data...
> pubs.dbo.authors has 23 records
> tempdb.dbo.authors has 20 records
> I want to see the difference. Hope this make sense
>|||SELECT a.ID, a.CheckSum
>From (Select au_id as "ID", BINARY_CHECKSUM(*) as "CheckSum"
FROM pubs.dbo.authors ) a
Inner Join (
Select au_id as "ID", BINARY_CHECKSUM(*) as "CheckSum"
FROM tempdb.dbo.authors ) b
On a.ID = b.ID
Where a.CheckSum != b.CheckSum
I tried this query but it doesn't return last three missing records(I
deleted those records from tempdb.dbo.rad_oltp to check if they come
from pubs.dbo.authors table up) ... but nothing returned...|||here are 3 more ways
select * from tempdb..authors t2 right join pubs..authors t1 on
t1.au_id =t2.au_id
where t2.au_id is null
select * from pubs..authors t1 left join tempdb..authors t2 on
t1.au_id =t2.au_id
where t2.au_id is null
select * from pubs..authors t1 where not exists(select * from
tempdb..authors where t1.au_id =au_id)
Denis the SQL Menace
http://sqlservercode.blogspot.com/|||SELECT a.ID, a.CheckSum
>From (Select au_id as "ID", BINARY_CHECKSUM(*) as "CheckSum"
FROM pubs.dbo.authors ) a
Inner Join (
Select au_id as "ID", BINARY_CHECKSUM(*) as "CheckSum"
FROM tempdb.dbo.authors ) b
On a.ID = b.ID
Where a.CheckSum != b.CheckSum
I tried this query but it doesn't return last three missing records(I
deleted those records from tempdb.dbo.rad_oltp to check if they come
from pubs.dbo.authors table up) ... but nothing returned...
My mistake.. there is a typo .. it is tempdb.dbo.authors|||Here we go
--Not in Pubs
select 'DoesNotExistOnProduction',t2.au_id from pubs..authors t1
right join tempdb..authors t2 on t1.au_id =t2.au_id
where t1.au_id is null
union all
--Not in Temp
select 'DoesNotExistInStaging',t1.au_id from pubs..authors t1 left
join tempdb..authors t2 on t1.au_id =t2.au_id
where t2.au_id is null
union all
--Data Mismatch
select 'DataMismatch', t1.au_id from( select BINARY_CHECKSUM(*) as
CheckSum1 ,au_id from pubs..authors) t1
join(
select BINARY_CHECKSUM(*) as CheckSum2,au_id from tempdb..authors) t2
on t1.au_id =t2.au_id
Where CheckSum1 <> CheckSum2
Here is the complete script that I used to create the authors2 table
and modify/add records to test
--let's copy over 20 rows to a table named authors2
select top 20 * into tempdb..authors2 from pubs..authors
--update 5 records by appending X to the au_fnam
set rowcount 5
update tempdb..authors2
set au_fname =au_fname +'X'
set rowcount 0
--let's insert a row that doesn't exist in pubs
insert into tempdb..authors2
select '666-66-6666', au_lname, au_fname, phone, address, city, state,
zip, contract
from tempdb..authors2
where au_id ='172-32-1176'
--The BIG SELECT
--Not in Pubs
select 'DoesNotExistOnProduction',t2.au_id from pubs..authors t1
right join tempdb..authors2 t2 on t1.au_id =t2.au_id
where t1.au_id is null
union all
--Not in Temp
select 'DoesNotExistInStaging',t1.au_id from pubs..authors t1 left
join tempdb..authors2 t2 on t1.au_id =t2.au_id
where t2.au_id is null
union all
--Data Mismatch
select 'DataMismatch', t1.au_id from( select BINARY_CHECKSUM(*) as
CheckSum1 ,au_id from pubs..authors) t1
join(
select BINARY_CHECKSUM(*) as CheckSum2,au_id from tempdb..authors2) t2
on t1.au_id =t2.au_id
Where CheckSum1 <> CheckSum2
Denis the SQL Menace
http://sqlservercode.blogspot.com/|||Thank you so much.. that worked!! :)
You made my day:):):)|||No problem
Denis the SQL Menace
http://sqlservercode.blogspot.com/|||One more question... I tried using more then one column to check the
data mismatch...
--Data Mismatch
select 'DataMismatch', t1.au_id, t1.au_lname, t1.au_fname from( select
BINARY_CHECKSUM(*) as
CheckSum1 ,au_id, au_lname, au_fname from pubs..authors) t1
join(
select BINARY_CHECKSUM(*) as CheckSum2,au_id, from tempdb..authors2)
t2
on t1.au_id =t2.au_id
Where CheckSum1 <> CheckSum2
did not work as I intended...|||Sorry what I just posted was a stupid question... my mistake.....
ddddduhhhh|||CHECKSUM(*) will use all columns
Denis the SQL Menace
http://sqlservercode.blogspot.com/sql

Database Collation setting

I have a SQL Server 2005 database which is set for

SQL_Latin1_General_Cp1_CI_AS collation (Actually when the instance was created it was set to this collation).....I have lot og objects tables,views, fks, col constraints , triggers, default etc defined....

I need to change the collation of the database and subsequently affecting the collation of every single column to SQL_Latin1_General_Cp1_CS_AS

Now when I run the following command i gives me lot of errors saying that

ALTER DATABASE <dbName> COLLATE SQL_Latin1_General_Cp1_CS_AS

The column constranint <xx> is dependent on collation .....

The funny part is that this col constraint is defined on a float column instead of varchar column.....why is it giving error when it does not have any collation associated with it?

What are the steps that I need to take before running the alter collation on the database? (mean disabling fks constraints, col constraints etc,,,)

Any pointers will be greatly appreciated.

Regards

Imtiaz

It's not just straigt forward to change collation. My best experience is to (generate) script the old database and change the collation when creating a new one. After this you can import the tables into the new database with correct collation. If you use tempdb and don't want to use the collate clause - you need to rebuild the master database and all the system databases.

Hope this helps.

Thursday, March 22, 2012

database backup job quits for no apparent reason

I created a maintenance plan to back up a database as a file to another server. Full backup was specified. The job has been running for about 3 months, then quit last night (after the server was rebooted). Error is:

Message
Executed as user: xxxxx\Administrator. The command line parameters are invalid. The step failed.

not sure what to do to fix this - -

Do a profiler trace to see if it's a TSQL issue somewhere, maybe the plan was accidentally changed somehow.|||I turned on Profiler to trace database backups - now all the backups are running fine -|||This is typically caused by the account changing the password. If you change the password of the account you used to run the job, you won't see any problems until you reboot your server/restart SQL Server service as this is the only time that the new security credentials will take effect.|||the jobs were created by and are run under the domain master system administrator account|||

Please go the SQL server jobs and change user domain\Administrator to sa (SQL Administrators).

it should be resolve......

Wednesday, March 21, 2012

Database backup fails

Hi,
I have three databases on a SQL Server. I have created three separate
maintenance plans for the three databases. The plans are exactly identical
except for the time of the complete backup. The complete backup of all the
three databases happens every night at different times and the transaction
log backup takes place every 3 hours during 11 AM and 5 PM. However, from the
first day onwards, plan for database one always fails while the plans for the
other two databases execute successfully. I don't know what I am doing
incorrectly. Can someone please let me know how to figure out the reason for
the failure?
Sharman,
You can view the error log and the event log for more details. In addition
you can right click the maintenance plan and choose Maintenance Plan
History...
Also make sure you have not selected the 'Attempt to repair any minor
problems' checkbox. Requires the DB to be in single user mode.
HTH
Jerry
"sharman" <sharman@.discussions.microsoft.com> wrote in message
news:376FA452-F24E-4D3B-8AB2-9AD221645CB4@.microsoft.com...
> Hi,
> I have three databases on a SQL Server. I have created three separate
> maintenance plans for the three databases. The plans are exactly identical
> except for the time of the complete backup. The complete backup of all the
> three databases happens every night at different times and the transaction
> log backup takes place every 3 hours during 11 AM and 5 PM. However, from
> the
> first day onwards, plan for database one always fails while the plans for
> the
> other two databases execute successfully. I don't know what I am doing
> incorrectly. Can someone please let me know how to figure out the reason
> for
> the failure?
>

Database backup fails

Hi,
I have three databases on a SQL Server. I have created three separate
maintenance plans for the three databases. The plans are exactly identical
except for the time of the complete backup. The complete backup of all the
three databases happens every night at different times and the transaction
log backup takes place every 3 hours during 11 AM and 5 PM. However, from th
e
first day onwards, plan for database one always fails while the plans for th
e
other two databases execute successfully. I don't know what I am doing
incorrectly. Can someone please let me know how to figure out the reason for
the failure?Sharman,
You can view the error log and the event log for more details. In addition
you can right click the maintenance plan and choose Maintenance Plan
History...
Also make sure you have not selected the 'Attempt to repair any minor
problems' checkbox. Requires the DB to be in single user mode.
HTH
Jerry
"sharman" <sharman@.discussions.microsoft.com> wrote in message
news:376FA452-F24E-4D3B-8AB2-9AD221645CB4@.microsoft.com...
> Hi,
> I have three databases on a SQL Server. I have created three separate
> maintenance plans for the three databases. The plans are exactly identical
> except for the time of the complete backup. The complete backup of all the
> three databases happens every night at different times and the transaction
> log backup takes place every 3 hours during 11 AM and 5 PM. However, from
> the
> first day onwards, plan for database one always fails while the plans for
> the
> other two databases execute successfully. I don't know what I am doing
> incorrectly. Can someone please let me know how to figure out the reason
> for
> the failure?
>

Database backup fails

Hi,
I have three databases on a SQL Server. I have created three separate
maintenance plans for the three databases. The plans are exactly identical
except for the time of the complete backup. The complete backup of all the
three databases happens every night at different times and the transaction
log backup takes place every 3 hours during 11 AM and 5 PM. However, from the
first day onwards, plan for database one always fails while the plans for the
other two databases execute successfully. I don't know what I am doing
incorrectly. Can someone please let me know how to figure out the reason for
the failure?Sharman,
You can view the error log and the event log for more details. In addition
you can right click the maintenance plan and choose Maintenance Plan
History...
Also make sure you have not selected the 'Attempt to repair any minor
problems' checkbox. Requires the DB to be in single user mode.
HTH
Jerry
"sharman" <sharman@.discussions.microsoft.com> wrote in message
news:376FA452-F24E-4D3B-8AB2-9AD221645CB4@.microsoft.com...
> Hi,
> I have three databases on a SQL Server. I have created three separate
> maintenance plans for the three databases. The plans are exactly identical
> except for the time of the complete backup. The complete backup of all the
> three databases happens every night at different times and the transaction
> log backup takes place every 3 hours during 11 AM and 5 PM. However, from
> the
> first day onwards, plan for database one always fails while the plans for
> the
> other two databases execute successfully. I don't know what I am doing
> incorrectly. Can someone please let me know how to figure out the reason
> for
> the failure?
>

Sunday, March 11, 2012

Database attach error 3624

Hi all,

I am trying to restore and SQL 2000 database into a new SQL 2005 database. I performed by SQL 2000 backup and created a blank database FERS_Production in SQL 2005. FERS_Production was the original name of the database in the SQL 2000 instance.

I have tried giving the new database the same name as the original and a different name to the original database

(Below is the scripted T-SQL that I get from the DB Admin tool

RESTORE DATABASE [Fers_Production]
FILE = N'FERS_Production_dat',
FILE = N'FERS_Production_log'
FROM DISK = N'D:\Microsoft SQL Server (2000)\MSSQL\Backup\Fers_Production\Fers_Production_db_200607270206.BAK'
WITH FILE = 1,
NOUNLOAD,
REPLACE,
STATS = 10
GO

When I run this I get the following error.

Msg 3154, Level 16, State 4, Line 1
The backup set holds a backup of a database other than the existing 'Fers_Production' database.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.

Other searches I have performed trying to fix this problem have said to use the REPLACE clause with the RESTORE DATABASE command, but as you can see I am doing that.

Also I no longer have SQL 2000 installed so I cannot try to do a DTS copy which was another suggestion I came across.

Any help is much appriciated, many thanks

Derek

Hi all,

Since I was having problems with a SQL 2000 database to SQL 2005 restore (which I have posted seperately) I tried copying the data files to a new folder and just attaching to the SQL 2000 database file from the SQL 2005 managment studio but I get the following error (I am runing service pack 1 for SQL 2005)

TITLE: Microsoft SQL Server Management Studio

Attach database failed for Server 'DATABASESERVER'. (Microsoft.SqlServer.Smo)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.2047.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Attach+database+Server&LinkId=20476


ADDITIONAL INFORMATION:

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

A system assertion check has failed. Check the SQL Server error log for details
Could not open new database 'Fers_Production'. CREATE DATABASE is aborted.
Location: IndexDataSet.cpp:12001
Expression: retCode == INSERT_SUCCESSFUL
SPID: 53
Process ID: 1092 (Microsoft SQL Server, Error: 3624)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=3624&LinkId=20476


Unfortunately the link that MS provide says there is no aditional info.

Thanks

Derek

|||

The restore process cannot restore the database from the backup file because there is already a database called Fers_Production present on your SQL 2005 server. Try deleting the Fers_Production database you created and then do the restore of the backup file.

|||

Thanks Andy. I restored the database to a name that did not already exist in the server and that seemed to do the trick as you suggested.

I had been used to being able to restore over an existing database but probably this could not work due to the backup being a SQL 2000 db and the new db is SQL 2005.

Thanks for your help.

Derek

|||I have merged these threads, as the error seems to be the same in both cases.|||

Derek,

Was your database attached with the .ldf and .mdf files in a specific location and then you detached the database, moved the files and tried to reattach the database? If this is the case, move the files back to the original location and reattach the database, then run this in the query window. Modify the part in red to where you want the new location of the files to be.

use fers_production
go
Alter database fers_production modify file (name = fers_production, filename = 'F:\Sqldata\fers_production.mdf')
go
Alter database fers_production modify file (name = fers_production_log, filename = 'F:\Sqllogs\fers_production.ldf')
go

Then restart SQL Server after you have done this.

|||

Thanks again Andy,

I have been caught up with other things hence the delay in my saying thanks.

I will keep that last suggestion in my notes as that my be useful at other times. I had manually moved the original files, I must remember not to do that in future.

Cheers

Derek

|||

Backup File = mydatabase.bak

1. Run Microsoft SQL Server Management Studio application.

2. If mydatabase is in Databases : delete mydatabase.

3. Right Click to Databases and select Restore Database ....

4. Destination for restore -> To database: mydatabase

Source for restore -> select From device -> Specify the backup media and select the backup sets to restore

Select Options from Select a page and in Restore the database file as: type the fullpath for the mydatabase new location

(for initdb_Data line with .mdf extension and for initdb_Log line with .ldf extension

ex.:

C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\mydatabase.mdf

C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\mydatabase.ldf).

5. Press OK button.

Have fun!

|||

Hi,

I think I have a similar problem. Correct me if I am reading your answer wrong, Andy, but does it mean you cannot restore a database "on top" of existing db? (I must be wrong)
Here is the description of my problem,

I am trying to restore a SQL 2000 database to an existing SQL 2005 DB (and change the name of the db on the way). However when I attempt to do it I get following error

System.Data.SqlError: RESTORE cannot process database <<database name>> because it is in useby this session. It is recommended that the master databse be used when performing this operation.

I am not sure what it means that the datasbe is used by this session - is the the SQL management studio client opened? oh, btw. I've tried foing the same when i had mster database opened in the studio and got to a restore dialog from there, but no luck.
Any comments?

Regards,

Jacek

|||

Try also removing the NOUNLOAD option - you should then be able to restore over an existing database (still need REPLACE as well)

I used the following code to successfully restore a SDQL 200 backup file to a databasde with the same name in SQL 2005 that already existed.

RESTORE DATABASE [ELF2] FROM DISK = N'Z:\ELF2' WITH FILE = 1, REPLACE,
STATS = 10
GO

|||

Barry many thanks for this!

I was converting from msde 2000, I upgraded the server to 2005 express, and believed that this was enough to convert it, indeed some things will not work if you do this upgrade, then backup and then try to restore, which added fuel to my believe that upgrading the server also does the database. But apparently not completely. So after 24hrs of messing thanks for this tip.

I am creating live deployment script that due to Vistas security has now been moved from batch files called post-MSI (which now make the MSI fail in vista) So I call them now from inside the application itself on first boot-up. Here is the script: if you want to get an example .bak download the trial from http://www.SalonSoftwareSystem.com and see the c:\install directory for the .bak. I'm glad Vista is protecting the layman but its been a good 2 months of effort to get our install vista happy.

I think the real trick is to accept the system default .MDF .LDF paths although as developers we feel it is messy and unpredictable it is safer and Vista compatible.

--live copy
use tempdb

create database Platinum
go

alter database Platinum set single_user with rollback immediate
go

alter database Platinum set multi_user with rollback immediate
go

--if it has a name it will restore over the system decided path
RESTORE DATABASE [Platinum] FROM DISK = N'C:\install\Platinum.bak' WITH FILE = 1, REPLACE,
STATS = 10
GO

ALTER database Platinum set recovery SIMPLE
GO

--Training Copy exactly the same copy
use tempdb

create database PlatinumTraining
go

alter database PlatinumTraining set single_user with rollback immediate
go

alter database PlatinumTraining set multi_user with rollback immediate
go

RESTORE DATABASE [PlatinumTraining] FROM DISK = N'C:\install\Platinum.bak' WITH FILE = 1, REPLACE,
STATS = 10
GO

ALTER database PlatinumTraining set recovery SIMPLE
GO

|||

"The backup set holds a backup of a database other than the existing 'Fers_Production' database."

Make sure you go to the options of the restore database screen in 2005 - make sure you have "overwrite existing database" selected.

Database attach error 3624

Hi all,

I am trying to restore and SQL 2000 database into a new SQL 2005 database. I performed by SQL 2000 backup and created a blank database FERS_Production in SQL 2005. FERS_Production was the original name of the database in the SQL 2000 instance.

I have tried giving the new database the same name as the original and a different name to the original database

(Below is the scripted T-SQL that I get from the DB Admin tool

RESTORE DATABASE [Fers_Production]
FILE = N'FERS_Production_dat',
FILE = N'FERS_Production_log'
FROM DISK = N'D:\Microsoft SQL Server (2000)\MSSQL\Backup\Fers_Production\Fers_Production_db_200607270206.BAK'
WITH FILE = 1,
NOUNLOAD,
REPLACE,
STATS = 10
GO

When I run this I get the following error.

Msg 3154, Level 16, State 4, Line 1
The backup set holds a backup of a database other than the existing 'Fers_Production' database.
Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.

Other searches I have performed trying to fix this problem have said to use the REPLACE clause with the RESTORE DATABASE command, but as you can see I am doing that.

Also I no longer have SQL 2000 installed so I cannot try to do a DTS copy which was another suggestion I came across.

Any help is much appriciated, many thanks

Derek

Hi all,

Since I was having problems with a SQL 2000 database to SQL 2005 restore (which I have posted seperately) I tried copying the data files to a new folder and just attaching to the SQL 2000 database file from the SQL 2005 managment studio but I get the following error (I am runing service pack 1 for SQL 2005)

TITLE: Microsoft SQL Server Management Studio

Attach database failed for Server 'DATABASESERVER'. (Microsoft.SqlServer.Smo)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.2047.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Attach+database+Server&LinkId=20476


ADDITIONAL INFORMATION:

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

A system assertion check has failed. Check the SQL Server error log for details
Could not open new database 'Fers_Production'. CREATE DATABASE is aborted.
Location: IndexDataSet.cpp:12001
Expression: retCode == INSERT_SUCCESSFUL
SPID: 53
Process ID: 1092 (Microsoft SQL Server, Error: 3624)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&EvtSrc=MSSQLServer&EvtID=3624&LinkId=20476


Unfortunately the link that MS provide says there is no aditional info.

Thanks

Derek

|||

The restore process cannot restore the database from the backup file because there is already a database called Fers_Production present on your SQL 2005 server. Try deleting the Fers_Production database you created and then do the restore of the backup file.

|||

Thanks Andy. I restored the database to a name that did not already exist in the server and that seemed to do the trick as you suggested.

I had been used to being able to restore over an existing database but probably this could not work due to the backup being a SQL 2000 db and the new db is SQL 2005.

Thanks for your help.

Derek

|||I have merged these threads, as the error seems to be the same in both cases.|||

Derek,

Was your database attached with the .ldf and .mdf files in a specific location and then you detached the database, moved the files and tried to reattach the database? If this is the case, move the files back to the original location and reattach the database, then run this in the query window. Modify the part in red to where you want the new location of the files to be.

use fers_production
go
Alter database fers_production modify file (name = fers_production, filename = 'F:\Sqldata\fers_production.mdf')
go
Alter database fers_production modify file (name = fers_production_log, filename = 'F:\Sqllogs\fers_production.ldf')
go

Then restart SQL Server after you have done this.

|||

Thanks again Andy,

I have been caught up with other things hence the delay in my saying thanks.

I will keep that last suggestion in my notes as that my be useful at other times. I had manually moved the original files, I must remember not to do that in future.

Cheers

Derek

|||

Backup File = mydatabase.bak

1. Run Microsoft SQL Server Management Studio application.

2. If mydatabase is in Databases : delete mydatabase.

3. Right Click to Databases and select Restore Database ....

4. Destination for restore -> To database: mydatabase

Source for restore -> select From device -> Specify the backup media and select the backup sets to restore

Select Options from Select a page and in Restore the database file as: type the fullpath for the mydatabase new location

(for initdb_Data line with .mdf extension and for initdb_Log line with .ldf extension

ex.:

C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\mydatabase.mdf

C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\mydatabase.ldf).

5. Press OK button.

Have fun!

|||

Hi,

I think I have a similar problem. Correct me if I am reading your answer wrong, Andy, but does it mean you cannot restore a database "on top" of existing db? (I must be wrong)
Here is the description of my problem,

I am trying to restore a SQL 2000 database to an existing SQL 2005 DB (and change the name of the db on the way). However when I attempt to do it I get following error

System.Data.SqlError: RESTORE cannot process database <<database name>> because it is in useby this session. It is recommended that the master databse be used when performing this operation.

I am not sure what it means that the datasbe is used by this session - is the the SQL management studio client opened? oh, btw. I've tried foing the same when i had mster database opened in the studio and got to a restore dialog from there, but no luck.
Any comments?

Regards,

Jacek

|||

Try also removing the NOUNLOAD option - you should then be able to restore over an existing database (still need REPLACE as well)

I used the following code to successfully restore a SDQL 200 backup file to a databasde with the same name in SQL 2005 that already existed.

RESTORE DATABASE [ELF2] FROM DISK = N'Z:\ELF2' WITH FILE = 1, REPLACE,
STATS = 10
GO

|||

Barry many thanks for this!

I was converting from msde 2000, I upgraded the server to 2005 express, and believed that this was enough to convert it, indeed some things will not work if you do this upgrade, then backup and then try to restore, which added fuel to my believe that upgrading the server also does the database. But apparently not completely. So after 24hrs of messing thanks for this tip.

I am creating live deployment script that due to Vistas security has now been moved from batch files called post-MSI (which now make the MSI fail in vista) So I call them now from inside the application itself on first boot-up. Here is the script: if you want to get an example .bak download the trial from http://www.SalonSoftwareSystem.com and see the c:\install directory for the .bak. I'm glad Vista is protecting the layman but its been a good 2 months of effort to get our install vista happy.

I think the real trick is to accept the system default .MDF .LDF paths although as developers we feel it is messy and unpredictable it is safer and Vista compatible.

--live copy
use tempdb

create database Platinum
go

alter database Platinum set single_user with rollback immediate
go

alter database Platinum set multi_user with rollback immediate
go

--if it has a name it will restore over the system decided path
RESTORE DATABASE [Platinum] FROM DISK = N'C:\install\Platinum.bak' WITH FILE = 1, REPLACE,
STATS = 10
GO

ALTER database Platinum set recovery SIMPLE
GO

--Training Copy exactly the same copy
use tempdb

create database PlatinumTraining
go

alter database PlatinumTraining set single_user with rollback immediate
go

alter database PlatinumTraining set multi_user with rollback immediate
go

RESTORE DATABASE [PlatinumTraining] FROM DISK = N'C:\install\Platinum.bak' WITH FILE = 1, REPLACE,
STATS = 10
GO

ALTER database PlatinumTraining set recovery SIMPLE
GO

|||

"The backup set holds a backup of a database other than the existing 'Fers_Production' database."

Make sure you go to the options of the restore database screen in 2005 - make sure you have "overwrite existing database" selected.

Thursday, March 8, 2012

Database Aliases

Is there currently a way to created "database aliases"? We have many instances of SQL Server running in our development environment, and have a few metabases that are supposed to be in sync across all instances. It would be extremely handy to have a database "X" on Server A actually point to database "X" on Server B.

As far as any application is concerned, Server A has a database called "X", but in reality the database only physically exists on Server B.

It would be incredibly useful to centrally manage a database that is meant to be shared among many server installs. It would also help for app hosting situations.

If this isn't possible, I'll enter it as a feature request for a later version of SQL Server.

Thanks,
Bryan Somerville
Software Engineer
Retail Anywhere, Inc.

Have you considered using linked servers? It works with local and remote dbs, so you don't care where thoses dbs are. There is the slight drawback of addressing your special dbs with four part names, but that should be it**.

**unless there is overhead with query optimisation when a local db is accessed as a linked server. It works well but I haven't tested perf in complex scenarios.

hope it helps.

|||

Ahsukal wrote:

Have you considered using linked servers? It works with local and remote dbs, so you don't care where thoses dbs are. There is the slight drawback of addressing your special dbs with four part names, but that should be it**.

**unless there is overhead with query optimisation when a local db is accessed as a linked server. It works well but I haven't tested perf in complex scenarios.

hope it helps.

The concept is something of a beginning on what he's looking for, but he's after much, much more. Essentially, he's looking for a database name to be a pointer and nothing else. To use a linked server, at least in its simple form, the calling app would still have to be aware of the linked server (just as a linked server instead of as a different connection). One way you could somewhat force this would be to create a different linked server for each database, and train the application to that. After that, whether the linked server is just another name for the local server, or serves as a passthrough to a different server is transparent to the calling application. You should start off with all databases on the same server, then move several off to another server without the applicaiton knowing (simply by changing the link associated with the linked server paired to that database). Note, however, that you are building significant management and performance overhead into things by doing it this way. You much deal with the issues surrounding the security pass through, and, perhaps more importantly, you are running things through the connectitivity layer not once, but twice now (with all that associated overhead).

|||

I find this a really interresting Idea, but from a slightly different perspective. This would mean that you can have two (or more) kind of front end database servers handling receiving all the requests, and have the database servers located behind these. The frontend servers could be load balanced using NLB. This would potentially improve the security, as none of the clients needs to have access directly to the backend servers, only to the front-end, which does not contain any data.

I also see the advantage mentioned above regarding splitting the data. However, I can see an even greater improvement, it would simplify the process of migrating a database to new server. You do not need to do anything special on the client, nor the new server. You only have to update the reference, making it point to the new location. This would really be a nice feature, but unless the development team have started on this one already, I'm afraid it won't make it in SQL Server 2008.

|||That would also be a nice benefit, yes.

Regarding security passthrough - that's a very good point. Perhaps an explicit linked server connection or other trust relationship could be required for aliasing to take place.

The issue that made me ask about this is as follows:

Our primary application is based on an extremely complicated, industry-specific (retail) database standard. We have a metabase that defines more intuitive "objects" like Customers, Items, Discounts, etc, and bidirectional relationships between them all.

That database is often being added to, but is read only as far as the application is concerned. Unfortunately, we have database servers running locally on our dev systems, we have a multi-tiered distribution and testing system, we have sales giving demos, we have implementation staging and assisting with pilots, etc. We have to continuously backup and restore this database to keep things current, but it's hard to keep everything synced up. Replication adds a layer of complexity that we don't quite want. The application is extremely extensible - we can add complex new features without touching almost any code, provided we can keep the metabase up to date.

All we need is a way to say "hey server, this database, as far as you care, is located elsewhere". When it comes time to take a backup to restore on site, the central database will be our only concern. When a client is hosted in our datacenter, we can just point it to the linked database.
|||

Instead of replication, consider using log shipping. Essentially just utilize the log to forward the changes to the other copies of the database without the need for the low level monitoring and subtle changes that replication induces.

|||

As the other authors on this thread have already indicated, currently there is no support for this functionality. If you haven't already done so, please file a request via http://connect.microsoft.com. That way the requested functionality gets tracked as a customer request and can be considered for a future release.

Thank you.

Database Aliases

Is there currently a way to created "database aliases"? We have many instances of SQL Server running in our development environment, and have a few metabases that are supposed to be in sync across all instances. It would be extremely handy to have a database "X" on Server A actually point to database "X" on Server B.

As far as any application is concerned, Server A has a database called "X", but in reality the database only physically exists on Server B.

It would be incredibly useful to centrally manage a database that is meant to be shared among many server installs. It would also help for app hosting situations.

If this isn't possible, I'll enter it as a feature request for a later version of SQL Server.

Thanks,
Bryan Somerville
Software Engineer
Retail Anywhere, Inc.

Have you considered using linked servers? It works with local and remote dbs, so you don't care where thoses dbs are. There is the slight drawback of addressing your special dbs with four part names, but that should be it**.

**unless there is overhead with query optimisation when a local db is accessed as a linked server. It works well but I haven't tested perf in complex scenarios.

hope it helps.

|||

Ahsukal wrote:

Have you considered using linked servers? It works with local and remote dbs, so you don't care where thoses dbs are. There is the slight drawback of addressing your special dbs with four part names, but that should be it**.

**unless there is overhead with query optimisation when a local db is accessed as a linked server. It works well but I haven't tested perf in complex scenarios.

hope it helps.

The concept is something of a beginning on what he's looking for, but he's after much, much more. Essentially, he's looking for a database name to be a pointer and nothing else. To use a linked server, at least in its simple form, the calling app would still have to be aware of the linked server (just as a linked server instead of as a different connection). One way you could somewhat force this would be to create a different linked server for each database, and train the application to that. After that, whether the linked server is just another name for the local server, or serves as a passthrough to a different server is transparent to the calling application. You should start off with all databases on the same server, then move several off to another server without the applicaiton knowing (simply by changing the link associated with the linked server paired to that database). Note, however, that you are building significant management and performance overhead into things by doing it this way. You much deal with the issues surrounding the security pass through, and, perhaps more importantly, you are running things through the connectitivity layer not once, but twice now (with all that associated overhead).

|||

I find this a really interresting Idea, but from a slightly different perspective. This would mean that you can have two (or more) kind of front end database servers handling receiving all the requests, and have the database servers located behind these. The frontend servers could be load balanced using NLB. This would potentially improve the security, as none of the clients needs to have access directly to the backend servers, only to the front-end, which does not contain any data.

I also see the advantage mentioned above regarding splitting the data. However, I can see an even greater improvement, it would simplify the process of migrating a database to new server. You do not need to do anything special on the client, nor the new server. You only have to update the reference, making it point to the new location. This would really be a nice feature, but unless the development team have started on this one already, I'm afraid it won't make it in SQL Server 2008.

|||That would also be a nice benefit, yes.

Regarding security passthrough - that's a very good point. Perhaps an explicit linked server connection or other trust relationship could be required for aliasing to take place.

The issue that made me ask about this is as follows:

Our primary application is based on an extremely complicated, industry-specific (retail) database standard. We have a metabase that defines more intuitive "objects" like Customers, Items, Discounts, etc, and bidirectional relationships between them all.

That database is often being added to, but is read only as far as the application is concerned. Unfortunately, we have database servers running locally on our dev systems, we have a multi-tiered distribution and testing system, we have sales giving demos, we have implementation staging and assisting with pilots, etc. We have to continuously backup and restore this database to keep things current, but it's hard to keep everything synced up. Replication adds a layer of complexity that we don't quite want. The application is extremely extensible - we can add complex new features without touching almost any code, provided we can keep the metabase up to date.

All we need is a way to say "hey server, this database, as far as you care, is located elsewhere". When it comes time to take a backup to restore on site, the central database will be our only concern. When a client is hosted in our datacenter, we can just point it to the linked database.
|||

Instead of replication, consider using log shipping. Essentially just utilize the log to forward the changes to the other copies of the database without the need for the low level monitoring and subtle changes that replication induces.

|||

As the other authors on this thread have already indicated, currently there is no support for this functionality. If you haven't already done so, please file a request via http://connect.microsoft.com. That way the requested functionality gets tracked as a customer request and can be considered for a future release.

Thank you.

Database Acting Strange

MY DATABASE FOR SHOPPING CART IS ACTING STRANGE IT HAS AUTOMATICALLY DESTOYED ALL PRIMARY KEYS. AND HAS CREATED 4 DUPLICATE RECORDS FOR EACH RECORD SO AT THIS STAGE I HAVE AROUNG 15000 RECORDS IN EACH TABLE IT MEANS 15 TIMES 4 60000 RECORDS. CAN ANYONE UPDATEME WHY THIS HAS HAPPENED AND WHAT CAN BE DONE TO DELETE EXISTING DUPLICATES. I NEED FAST REPLY IN THIS MATTER AS THIS IS URGENT. IF POSSIBLE KINDLY WRITE QUERIES TRIGGERS FOR FUTURE PROBLEMS AS WELL AS THESE DAYS I AM SICK SO MY BRAIN AINT WORKING IN THIS MATTER. URGENT URGENT URGENT THANKS ALOT I HAVE PREVIOUSLY POSTED AND HAVE GOT A GOOD RESPONSE. AND HOPE A GOOD ONE AGAIN. ONE MORE THING IS THAT I HAVE A BACKUP HERE AT MY OFFICE SYSTEM IT ALSO HAS DONE THE SAMETHING. I MADE A NEW DATABASE AND TRYED TO IMPORT DATA WITH DISTINCT KEYWORD BUUT IT IS NOT COPYING IT AS WELL. URGENT RESPONSE REQUIRED IF ANYONE CAN DO.It's that damn Miracle thing againnn....I hate when that happens...

Who else has sa rights to the server?|||Computers are like dogs. They can sense fear. You need to stop panicking and find out exactly when this occured, what was running, who was logged in, what the last code changes implemented were, etc...
Standard problem solving mode.

SQL Server will not, of its own accord, drop keys and duplicate records. Someone or some code did this.|||...and if I could write queries and triggers for future problems I'd be a wealthy man.|||Originally posted by blindman
...and if I could write queries and triggers for future problems I'd be a wealthy man.

LOL

Still working on the AI_DBA module?|||Oh, I finished that months ago. Works like a charm. But if I release it, I'd be out of a job.

If someone invented a light bulb that never burned out, who would want to manufacture them?|||What does that module do?|||AI_DBA module automatically and flawlessly performs all Database Administration and Development duties without the need for high-priced talent. It's user inteface consists of a single button that says "OK". It senses the manner and duration of the keypress to intuitively analyze the user's intentions and create a complete Requirements Document based upon the user's subconcious needs rather than just what they SAY they want, and completes the task within and regardless of all the unreasonable restrictions placed upon it by a boss who "knows better". It's "I told you so" submodule has been completely removed to spare any egos, and if you have an internet connection it automatically logs into dbforums three times each day and answers all questions containing the text words "date" and "format".|||OK-OK, I got the drift :)|||Originally posted by blindman
AI_DBA module automatically and flawlessly performs all Database Administration and Development duties without the need for high-priced talent. It's user inteface consists of a single button that says "OK". It senses the manner and duration of the keypress to intuitively analyze the user's intentions and create a complete Requirements Document based upon the user's subconcious needs rather than just what they SAY they want, and completes the task within and regardless of all the unreasonable restrictions placed upon it by a boss who "knows better". It's "I told you so" submodule has been completely removed to spare any egos, and if you have an internet connection it automatically logs into dbforums three times each day and answers all questions containing the text words "date" and "format".

Yup...that's about right...

I like the subconcious part...

Sunday, February 19, 2012

Data type error

I have created a Foreach Loop container which generates a string variable which is a Select statement that in turn used in my OLE DB source in my Data Flow task. I have a 3 variables that I am using to create the Select statement. Two of them work fine but the 3rd gives me an error "Cannot convert varchar to numeric" after about the 5th or 6th loop which is odd as the variable is the same for each pass.

The SQL Task linked to the Foreach Loop is a query as follows

SELECT DISTINCT

CAST(FYr as varchar(4)) as FYr,

CAST(Acct1 as varchar(13)) as Acct1,

CAST(Acct2 as varchar(13)) as Acct2

FROM GL, AcctTbl

The resulting dataset looks like this (there is only one record in AcctTbl)

FYr Acct1 Acct2

2000 400.00 307.00

2001 400.00 307.00

2002 400.00 307.00

etc, which is exactly what I want.

I've created package scope string variables for sFYr, sAcct1 and sAcct2 as well as another variable qrySQL

The value for qrySQL string variable is something like this

"Select " + @.User :: sFYr + " as FiscalYear, Account, " + @.User :: sAcct2 + "Amount FROM tblGL WHERE Account < " + @.User :: sAcct1

This is then used as my datasourse in my data flow task

When I run the package it goes through a half a dozen iterations ( there are about a dozen total rows to iterate) and successfully writes the results to my data destination table but then fails with the "cannot convert varchar to numeric" message.

It seems to be with the sAcct1 variable because if I use the same string for my qrySQL except I replace the sAcct1 variable with string (as shown below) the package completes successfully

"Select " + @.User :: sFYr + " as FiscalYear, Account, " + @.User :: sAcct2 + "Amount FROM tblGL WHERE Account < '400.00'

Does anyone have any ideas? Can I not use the < to compare string? The Account field that I'm comparing is a varchar(13) field. I've even tried casting the Account and sAcct1 variable as numeric in the qrySQL string and I'm getting the same failure after several iterations.

Any insight would really be appreciated. I've lost a bit of hair over this one.

Thanks in advance

You should be including single quotes around sAcct1 in the WHERE clause, such as "...WHERE Account < '" + @.User :: sAcct1 + "'"

I believe SQL Server is converting the value of your Account column to a numeric to match the datatype you are sending it. The error is occurring because you have data in that column that fails the conversion.
|||

wpwebster wrote:

I have created a Foreach Loop container which generates a string variable which is a Select statement that in turn used in my OLE DB source in my Data Flow task. I have a 3 variables that I am using to create the Select statement. Two of them work fine but the 3rd gives me an error "Cannot convert varchar to numeric" after about the 5th or 6th loop which is odd as the variable is the same for each pass.

The SQL Task linked to the Foreach Loop is a query as follows

SELECT DISTINCT

CAST(FYr as varchar(4)) as FYr,

CAST(Acct1 as varchar(13)) as Acct1,

CAST(Acct2 as varchar(13)) as Acct2

FROM GL, AcctTbl

The resulting dataset looks like this (there is only one record in AcctTbl)

FYr Acct1 Acct2

2000 400.00 307.00

2001 400.00 307.00

2002 400.00 307.00

etc, which is exactly what I want.

I've created package scope string variables for sFYr, sAcct1 and sAcct2 as well as another variable qrySQL

The value for qrySQL string variable is something like this

"Select " + @.User :: sFYr + " as FiscalYear, Account, " + @.User :: sAcct2 + "Amount FROM tblGL WHERE Account < " + @.User :: sAcct1

This is then used as my datasourse in my data flow task

When I run the package it goes through a half a dozen iterations ( there are about a dozen total rows to iterate) and successfully writes the results to my data destination table but then fails with the "cannot convert varchar to numeric" message.

It seems to be with the sAcct1 variable because if I use the same string for my qrySQL except I replace the sAcct1 variable with string (as shown below) the package completes successfully

"Select " + @.User :: sFYr + " as FiscalYear, Account, " + @.User :: sAcct2 + "Amount FROM tblGL WHERE Account < '400.00'

Does anyone have any ideas? Can I not use the < to compare string? The Account field that I'm comparing is a varchar(13) field. I've even tried casting the Account and sAcct1 variable as numeric in the qrySQL string and I'm getting the same failure after several iterations.

Any insight would really be appreciated. I've lost a bit of hair over this one.

Thanks in advance

Is it possible that Account column in tblGL table is numeric? if so, you make sure that you cast accordingly the values of acct1 from Acttbl table. Why are you casting it in the query as varchar and putting it in a string variable? would not be better to to use a data type that is consistent with tblGL.Account?

|||

Thanks for the input. It helped me get to the bottom of it. The Account field is a varchar(13) field although the accounts are in a format of something like 400.00 There was however several records I found where the Accocunt was NA, when I changed those through a derived column data flow control to a "0" it worked fine.

I still find it a bit puzzling that the WHERE clause worked when it was WHERE Account < '400.00' but wouldnt' work when it was WHERE Account < @.UserVariable

Making sure all Accounts looked like numbers did the trick though.

Thanks again for the input.

Regards

Bill

Friday, February 17, 2012

Data type change in SQL view

I've created a SQL View in SQL 2000 using a table that has columns
defined as Numeric data type. In the view, I am grouping and summing.
When I link the view via ODBC to Access, all of the data types are
changed to text. If I link the original table which the views are
created from to Access, the data types are correct. So this problem
obviously happens when I change the view to Group. Is there a way
around this? I want the data types to be correct in Access when I
link to the views.

thanks,

jimMR71 (mr71@.yahoo.com) writes:
> I've created a SQL View in SQL 2000 using a table that has columns
> defined as Numeric data type. In the view, I am grouping and summing.
> When I link the view via ODBC to Access, all of the data types are
> changed to text. If I link the original table which the views are
> created from to Access, the data types are correct. So this problem
> obviously happens when I change the view to Group. Is there a way
> around this? I want the data types to be correct in Access when I
> link to the views.

Not that I know anything about the Access part of this, but it
could help if you post the CREATE TABLE statements for your tables
and the CREATE VIEW statement.

--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp