Showing posts with label table. Show all posts
Showing posts with label table. Show all posts

Friday, March 30, 2012

Migrating from 2005 to 2005 Mobile

Hello All,

I have a database created on SQL Server 2005 and now I would like to migrate the table structure to a SQL Server 2005 Mobile database. Generating the scripts and running them against the mobile database generates a lot of error that I suppose are caused by not supported features or keywords on the mobile engine.

I would like to know what are the best procedure for doing such migration. Note that this has nothing to do with replicating, since the SQL Server 2005 database will be "discontinued" after the migration.

Thanks in Advance,

Igor Kondrasovas

you have a variety of options

1) you can create a new SQL Mobile database, add a subscription to it that subscribes to a publication which consists of the entire SS2005 database, and then merge replicate

2) you can script the DDL of the SS2005 database and run each statement a line at a time from a simple CF application on device to recreate the skeletal database

I walk you through how to do option 1 in the MSDN webcast I gave in Nov 2005.

http://msreadiness.com/WS_abstract.asp?eid=15003229

Darren

|||

Hello Darren,

Thanks for the help.

I was thinking that there I could just do that using the Management Studio.

I found out a tool called DataPort Wizard that is capable of doing such think, including table data very easily. I hope Microsoft will provide a way for doing that the same way this tool does (very easy by the way).

The other thing is that if you decide to create you own Mobile Database you cannot easily define contrainsts (as foreign keys) using the "Table Creation GUI". Only defining Primary Keys is Allowed. Besides, if you have foreign keys defined you cannot see them on the Colums definition on Management Studio, as you can see on the SQL Server 2005 database. Please correct me if I'm wrong.

Best Regards,

Igor Kondrasovas

|||

You are correct - you cannot do much in terms of defining constraints or altering tables visually in VS2005 or SS2005, but to be honest, the SQL to do this from code (or in SS2005 Mgmt Studio Query Window) is not difficult.

Darren

Migrating Foxpro table with memo fields to SQL Server

Hi Everyone,
Here is the issue : Getting error while transferring
foxpro data with memo fields. If I omit memo field, its
fine.
Could anyone know, how can I overcome this issue ?
Thanks in advance,
SKHow are you importing the data? Which version of FoxPro? What's the error
message?
The Visual FoxPro ODBC Driver supports memo fields (upto at least Fox 6.0)
and the DTS Import Wizard will automatically import them as Text columns if
you let it create the table for you. Fox 7.0 and 8.0 come with the newer
OLEDB driver. I haven't tried it with memo fields in DTS but I would expect
it to support Memo since the older driver does.
--
David Portas
--
Please reply only to the newsgroup
--

Wednesday, March 28, 2012

Migrating database table data from 2005 to 2000

I'm trying to get a database from SQL2005 to SQL2000. I already recreated the database in SQL2005 and I'm just trying to get some data from just a few tables.

It doesn't appear the DTS or any export functionality is available in my version of SQL Express 2005...so how do I do this. I've tried installing everything I can find.

I've also tried BCP but I keep getting these errors:

SQLState = 08001, NativeError = 53
Error = [Microsoft][SQL Native Client]Named Pipes Provider: Could not open a connection to SQL Server [53].
SQLState = HYT00, NativeError = 0
Error = [Microsoft][SQL Native Client]Login timeout expired
SQLState = 08001, NativeError = 53
Error = [Microsoft][SQL Native Client]An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections.

This is a LOCAL database and I have tried -T for trusted, I have also tried a username and password combination. The database is set to Allow Remote connections. Nothing is working.

I'm typing this

bcp somedb..countries out countries.csv -c -t , -S machine/SQLdatabase -T -U myusername

|||Moving to the SQL Server Express forum.|||

Your options are to (a) script out the tables, run those scripts in the SQL 2005 Express sever, and then use the Import/Export Wizard in SQL 2005 Express to move the data, (b) Check out some of the excellent third party tools.

Comparison Tools
Object Comparison:
AdeptSQL Diff
AlfaAlfa Software - SQL Server Comparison Tool
ApexSQL – SQL Diff
Best SoftTool – SQL DBCompare
e-Dule - DB SynchroComp
PrimeLogics - DataVision 2007
Quest – SchemaCompare
RAC4SQL's QALite (Free)
Red Gate – SQL Compare
SQL Effects Clarity
TASC - SQL Delta
Teratrax Database Compare
TulsaSoft - SQL Examiner
Voltex Data Systems - SQLDBcontrol
XpressApps - sqlXpress Diff
xSQL Software - xSQL Object
Data Comparison
ApexSQL – SQL Diff
Best SoftTool – SQL DBCompare
Quest - DataCompare
Red Gate – Data Compare
TASC - SQL Delta
TulsaSoft - SQL Data Examiner
xSQL Software - xSQL DataCompare
DTS Comparison
Red Gate – DTS Package Compare
Server Comparison
Quest - ServerCompare
Free Tools
RAC4SQL's QALite (Free)
SQL Effects Clarity CE Edition

|||

That would just get me to the same place I'm already at.

I don't have your step 3 this-->

Import/Export Wizard in SQL 2005 Express

These options do not appear in my SQL Server Management Studio Express. In fact, if they did, I'd be done.

|||

In Object Explorer, right click on your database, select [Tasks], then [Import].

Oops, forget the above, my mind was running on empty.

Try the DTSWizard:

{install drive}:\Program Files\Microsoft SQL Server\90\DTS\Binn\DTSWizard.exe

|||

Arnie: I don't got it. I have done a search for DTS* and there is no such file on my computer. I don't have import/export under task. I installed some of the extra tools but apparently not all and you can't rerun the installation program...its too stupid. You can only rerun it from add/remove SQL in the CP, and then its looking for a .msi file but Microsoft distributes the tools as an .EXE. Around and around you go....whoever wrote the installation for SQL Express/2005 should be fired...but only have he/she is beaten profusely about the head out back.

I have Express and apparently there is no SSIS available and no DTS avilable. I've been around this a 100 different ways. I only have 3 tables here....I just want to get bcp running and move on back to SQL 2000. It looks like Microsoft is now charging for the developer tools for SQL 2005 I guess..

I don't have a firewall running. Why does BCP error out? I'm at a loss.

|||

First, verify that [Allow Remote Connections] is checked in SQL Server Configuration Manager.

Second, the DTSWizard is available in the 'toolkit' for download here: http://go.microsoft.com/fwlink/?LinkId=65111

sql

Migrating data into dbf file

I have to migrate datat from my table to my accounting system.

The table fields of the accounting system are different from my sql table and the Acc sys accepts only .DBF files.

I would have to migrate the data daily.
So my question is: whats the best approach for doing this work.
Should I create a nother table in Sql Server with the field names as the dbf file and write a SP to get all the data from another tabel into this one and then using export wizard to export data into a dbf file.
Or is there any better appraoch
regards

Hi,
Perhaps the better approach is a Data Trasformation Service scheduled daily.
Best regards

Monday, March 26, 2012

Migrating a column from ntext to XML

After SQL Server 2005 migration, I'm trying to change my ntext column to XML type.

The "alter table TableName alter column XMLCol xml" command throw this error :

XML parsing: line 1, character 39, unable to switch the encoding

1. Do I have to reformat my nText column before the migration to XML type ?

2. Is there a way to create an XML data type with UFT-8 in SQL Server 2005 ?

Thank you for your help

Thank you for your help

the ntext column must contain well-formed xml to be converted. My guess is the the data in the ntext column looks something like:

<?xml version="1.0" encoding="utf-8"?><root/>

which specifies the wrong encoding for the the xml in an ntext column. If this is the case convert the column to varchar(max) first to fix the encoding, then to xml. For example:

alter table TableName alter column XMLCol varchar(max)
alter table TableName alter column XMLCol xml

If your ntest columns contain a mixture of

<?xml version="1.0" encoding="utf-8"?><root/>

and

<?xml version="1.0" encoding="utf-16"?><root/>

after alter the columns to varchar(max), update them to replace all the "utf-16" with "utf-8" before doing the alter to xml.

Dan AT pluralsight DOT com


|||

hi,

if you would be converting the column from ntext

and you have several hundereds of record in it already

it would be difficult to pinpoint the problem.

here's my suggestion

1. add a new column with XML data type. leave the old ntext column untouched

2. insert into the new column bby batch of 10, 20 or by hundred depending on the size of your table

3. what would be left are problematic not well formed xml

4. deal with the remaining data and insert to the new column

5. when everything is done. drop the old column

6. rename the new XML column with the previous column

regards,

joey

|||

Converting it to varchar(max) is still having the potential to lead to encoding issues or data corruption. Instead the column should be converted to varbinary(max) first and then to XML.

Best regards

Michael

Migrating a column from ntext to XML

After SQL Server 2005 migration, I'm trying to change my ntext column to XML type.

The "alter table TableName alter column XMLCol xml" command throw this error :

XML parsing: line 1, character 39, unable to switch the encoding

1. Do I have to reformat my nText column before the migration to XML type ?

2. Is there a way to create an XML data type with UFT-8 in SQL Server 2005 ?

Thank you for your help

Thank you for your help

the ntext column must contain well-formed xml to be converted. My guess is the the data in the ntext column looks something like:

<?xml version="1.0" encoding="utf-8"?><root/>

which specifies the wrong encoding for the the xml in an ntext column. If this is the case convert the column to varchar(max) first to fix the encoding, then to xml. For example:

alter table TableName alter column XMLCol varchar(max)
alter table TableName alter column XMLCol xml

If your ntest columns contain a mixture of

<?xml version="1.0" encoding="utf-8"?><root/>

and

<?xml version="1.0" encoding="utf-16"?><root/>

after alter the columns to varchar(max), update them to replace all the "utf-16" with "utf-8" before doing the alter to xml.

Dan AT pluralsight DOT com


|||

hi,

if you would be converting the column from ntext

and you have several hundereds of record in it already

it would be difficult to pinpoint the problem.

here's my suggestion

1. add a new column with XML data type. leave the old ntext column untouched

2. insert into the new column bby batch of 10, 20 or by hundred depending on the size of your table

3. what would be left are problematic not well formed xml

4. deal with the remaining data and insert to the new column

5. when everything is done. drop the old column

6. rename the new XML column with the previous column

regards,

joey

|||

Converting it to varchar(max) is still having the potential to lead to encoding issues or data corruption. Instead the column should be converted to varbinary(max) first and then to XML.

Best regards

Michael

migrating 2000 partitionned view to 2005 partitionned table?

Hi,
I have an SQL 2000 datawarehouse where my 2 biggest tables are partitionned
by year. (Fact_Table_2003, Fact_Table_2004,...)
I want to test to migrate to 2005 and I want to use the new partitionned
table options.
how to do this easely?
thanks.
Jerome.
I have not had to do this yet, so this is all theory from my
perspective.
But from what I have seen, you should be able to backup/restore your
database "as is" and then I from what I have seen, you just need to do
an ALTER TABLE...SWITCH to move the table data around. BOL has a topic
on "moving partitioned data" which lists one of the uses of SWITCH as
"Assigning a table as a partition to an already existing partitioned
table."
Assigning partitions to different tables is just a meta data operation
so it happens very quickly, no data is copied, pointers to the data are
just updated.
In a nutshell I think the process would go something like this:
1. migrate the database onto SQL2k5
2. join all the tables together using "ALTER TABLE..SWITCH"
3. drop the view
4. rename the table from step 2. with the same name as the view
5. re-create any Referential Integrity constraints
I would suggest doing a test on small sample database first (a copy of
one of the sample databases maybe)
HTH
Regards
Darren Gosbell [MCSD]
Blog: http://www.geekswithblogs.net/darrengosbell
In article <ePn#4Tk7FHA.3876@.TK2MSFTNGP09.phx.gbl>,
willgart@.BBBhotmailAAA.com says...
> Hi,
> I have an SQL 2000 datawarehouse where my 2 biggest tables are partitionned
> by year. (Fact_Table_2003, Fact_Table_2004,...)
> I want to test to migrate to 2005 and I want to use the new partitionned
> table options.
> how to do this easely?
> thanks.
> Jerome.
>
>

migrating 2000 partitionned view to 2005 partitionned table?

Hi,
I have an SQL 2000 datawarehouse where my 2 biggest tables are partitionned
by year. (Fact_Table_2003, Fact_Table_2004,...)
I want to test to migrate to 2005 and I want to use the new partitionned
table options.
how to do this easely?
thanks.
Jerome.I have not had to do this yet, so this is all theory from my
perspective.
But from what I have seen, you should be able to backup/restore your
database "as is" and then I from what I have seen, you just need to do
an ALTER TABLE...SWITCH to move the table data around. BOL has a topic
on "moving partitioned data" which lists one of the uses of SWITCH as
"Assigning a table as a partition to an already existing partitioned
table."
Assigning partitions to different tables is just a meta data operation
so it happens very quickly, no data is copied, pointers to the data are
just updated.
In a nutshell I think the process would go something like this:
1. migrate the database onto SQL2k5
2. join all the tables together using "ALTER TABLE..SWITCH"
3. drop the view
4. rename the table from step 2. with the same name as the view
5. re-create any Referential Integrity constraints
I would suggest doing a test on small sample database first (a copy of
one of the sample databases maybe)
HTH
--
Regards
Darren Gosbell [MCSD]
Blog: http://www.geekswithblogs.net/darrengosbell
In article <ePn#4Tk7FHA.3876@.TK2MSFTNGP09.phx.gbl>,
willgart@.BBBhotmailAAA.com says...
> Hi,
> I have an SQL 2000 datawarehouse where my 2 biggest tables are partitionned
> by year. (Fact_Table_2003, Fact_Table_2004,...)
> I want to test to migrate to 2005 and I want to use the new partitionned
> table options.
> how to do this easely?
> thanks.
> Jerome.
>
>

migrating 2000 partitionned view to 2005 partitionned table?

Hi,
I have an SQL 2000 datawarehouse where my 2 biggest tables are partitionned
by year. (Fact_Table_2003, Fact_Table_2004,...)
I want to test to migrate to 2005 and I want to use the new partitionned
table options.
how to do this easely?
thanks.
Jerome.
I have not had to do this yet, so this is all theory from my
perspective.
But from what I have seen, you should be able to backup/restore your
database "as is" and then I from what I have seen, you just need to do
an ALTER TABLE...SWITCH to move the table data around. BOL has a topic
on "moving partitioned data" which lists one of the uses of SWITCH as
"Assigning a table as a partition to an already existing partitioned
table."
Assigning partitions to different tables is just a meta data operation
so it happens very quickly, no data is copied, pointers to the data are
just updated.
In a nutshell I think the process would go something like this:
1. migrate the database onto SQL2k5
2. join all the tables together using "ALTER TABLE..SWITCH"
3. drop the view
4. rename the table from step 2. with the same name as the view
5. re-create any Referential Integrity constraints
I would suggest doing a test on small sample database first (a copy of
one of the sample databases maybe)
HTH
Regards
Darren Gosbell [MCSD]
Blog: http://www.geekswithblogs.net/darrengosbell
In article <ePn#4Tk7FHA.3876@.TK2MSFTNGP09.phx.gbl>,
willgart@.BBBhotmailAAA.com says...
> Hi,
> I have an SQL 2000 datawarehouse where my 2 biggest tables are partitionned
> by year. (Fact_Table_2003, Fact_Table_2004,...)
> I want to test to migrate to 2005 and I want to use the new partitionned
> table options.
> how to do this easely?
> thanks.
> Jerome.
>
>

migrating 2000 partitionned view to 2005 partitionned table?

Hi,
I have an SQL 2000 datawarehouse where my 2 biggest tables are partitionned
by year. (Fact_Table_2003, Fact_Table_2004,...)
I want to test to migrate to 2005 and I want to use the new partitionned
table options.
how to do this easely?
thanks.
Jerome.I have not had to do this yet, so this is all theory from my
perspective.
But from what I have seen, you should be able to backup/restore your
database "as is" and then I from what I have seen, you just need to do
an ALTER TABLE...SWITCH to move the table data around. BOL has a topic
on "moving partitioned data" which lists one of the uses of SWITCH as
"Assigning a table as a partition to an already existing partitioned
table."
Assigning partitions to different tables is just a meta data operation
so it happens very quickly, no data is copied, pointers to the data are
just updated.
In a nutshell I think the process would go something like this:
1. migrate the database onto SQL2k5
2. join all the tables together using "ALTER TABLE..SWITCH"
3. drop the view
4. rename the table from step 2. with the same name as the view
5. re-create any Referential Integrity constraints
I would suggest doing a test on small sample database first (a copy of
one of the sample databases maybe)
HTH
Regards
Darren Gosbell [MCSD]
Blog: http://www.geekswithblogs.net/darrengosbell
In article <ePn#4Tk7FHA.3876@.TK2MSFTNGP09.phx.gbl>,
willgart@.BBBhotmailAAA.com says...
> Hi,
> I have an SQL 2000 datawarehouse where my 2 biggest tables are partitionne
d
> by year. (Fact_Table_2003, Fact_Table_2004,...)
> I want to test to migrate to 2005 and I want to use the new partitionned
> table options.
> how to do this easely?
> thanks.
> Jerome.
>
>sql

migrating (cloning?) DTS mapping

I have a DTS package on SQL Server 2000 that loads a table from a text file daily. The text file has 148 distinct fields that are mapped to a corresponding 148 columns on the table. I need to recreate the package to SQL Server 2005. Is there any shortcut to replicating the mapping from DTS to SSIS or do I need to redo from the beginning?

Dennis Cronin wrote:

I have a DTS package on SQL Server 2000 that loads a table from a text file daily. The text file has 148 distinct fields that are mapped to a corresponding 148 columns on the table. I need to recreate the package to SQL Server 2005. Is there any shortcut to replicating the mapping from DTS to SSIS or do I need to redo from the beginning?

If there are 148 columns in both source and destination then you can probably use the Import Wizard to build the package for you and then adapt it as you wish. very easy and very quick.

-Jamie

Friday, March 23, 2012

Migrate VIEW from Access to SQLserver ??

I migrated a DB from Access 2000 to SQLserver 2000.

The tables are OK, but I see the old Access views... as TABLE in
SQLserver!!

Any suggestions?

--Access isn't "smart" enough to upsize its queries into MS SQL Server views
so instead it just runs the query and creates a table from the result.
You'll have to port all of the queries manually (although I'm sure there are
tools or at least guides to help you with this) since Access's SQL differs
from MS SQL Server's SQL. Some of the most common issues I've run in are
that MS SQL Server doesn't have all those handy VB functions and IsNull()
does not work the same way in both.

"YURYSSG" <yuryssg@.yahoo.it> wrote in message
news:2i85qbFjsi78U1@.uni-berlin.de...
> I migrated a DB from Access 2000 to SQLserver 2000.
> The tables are OK, but I see the old Access views... as TABLE in
> SQLserver!!
> Any suggestions?
> --|||"Jonathan Amend" <cephas_is@.hotmail.com> /
: news:40bf8fc4$1_3@.aeinews...
> Access isn't "smart" enough to upsize its queries into MS SQL Server views
> so instead it just runs the query and creates a table from the result.
> You'll have to port all of the queries manually (although I'm sure there
are
> tools or at least guides to help you with this) since Access's SQL differs
> from MS SQL Server's SQL. Some of the most common issues I've run in are
> that MS SQL Server doesn't have all those handy VB functions and IsNull()
> does not work the same way in both.
> "YURYSSG" <yuryssg@.yahoo.it> wrote in message
> news:2i85qbFjsi78U1@.uni-berlin.de...
> > I migrated a DB from Access 2000 to SQLserver 2000.
> > The tables are OK, but I see the old Access views... as TABLE in
> > SQLserver!!
> > Any suggestions?
> > --|||"Jonathan Amend" <cephas_is@.hotmail.com> wrote:

>Access isn't "smart" enough to upsize its queries into MS SQL Server views
>so instead it just runs the query and creates a table from the result.
>You'll have to port all of the queries manually (although I'm sure there are
>tools or at least guides to help you with this) since Access's SQL differs
>from MS SQL Server's SQL. Some of the most common issues I've run in are
>that MS SQL Server doesn't have all those handy VB functions and IsNull()
>does not work the same way in both.

FWIW I was able to programmatically make views out of many of my
Access queries.

I had much more code than this but the basics were as follows.

strNewSQL = adhReplace(Q.SQL, vbCrLf, " ")
strNewSQL = Left(strNewSQL, InStr(strNewSQL, ";") - 1)
strNewSQL = ConvertTrueFalseTo10(strNewSQL)

tagRetryAfterCleanup:
Set myquerydef = dbsPermanent.CreateQueryDef("")
'Q.Name & " DAO Test")
myquerydef.ReturnsRecords = False
myquerydef.Connect = strConnect
myquerydef.SQL = "CREATE VIEW [" & strQueryName & "]
AS " & strNewSQL
myquerydef.Execute
myquerydef.Close

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm

Wednesday, March 21, 2012

Migrate MSExcel worksheet sources to SQL2005

Hi,

Is there anyway I could do to migrate my data on my excel workbook to SQL Server 2005 per worksheet? Meaning, I have to create table for all my excel worksheet then transfer all the data to a new table through SSIS package.

How will I possibly do this? Please help.

Thanks in advance.

Have you tried the import wizard? That can import from Excel Data Sources.

-Jamie

|||Hi,

I just want to elaborate what I am about to do here to clarify things up.

In my case, I have 50 worksheet in my Excel workbook and I would like these worksheets be transferred in our SQL Server 2005 database, one table per worksheet. Now, I am planning to use SSIS "Foreach" control block so that SSIS recusively gets data on every worksheet, then SSIS package will transfer the data gathered on one table to another.

Is this task possible in SSIS? If not, kindly advise me of a more suitable solution for this. Or, is there any available custom script/coding for this in VS2005?

Please help. Thanks in advance.
|||

As Jamie said the Import Wizard should be able to help you.

In the SQL Server Management Studio right click on your destination database and choose Tasks->Import Data. Select Excel as your source and go from there.

Thanks.

Monday, March 12, 2012

Migrate ACCESS to MSSQL

Hi,
I created a table and filled data to it in ACCESS 2002. How can I migrate the ACCESS table data to MSSQL 2000 Server? The table in MSSQL DB has primary key and also has records. I want to append the ACCESS data (2 columns) to the existing table with the s
ame columns names in MSSQL.
How can I do it?
Thanks
Tom,
you can use the upsizing wizard or DTS. Here are some links to help you:
http://builder.com.com/5100-6388-5059624.html
http://support.microsoft.com/default.aspx?kbid=285829
http://support.microsoft.com/default...NoWebContent=1
HTH,
Paul Ibison
|||Most folks prefer using DTS to the upsizing wizard... However if you do use
the upsizing wizard, go back and ensure that the sql column data types are
appropriate... My experience with the wizard is that it makes the columns
sizes too large.
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Tom" <kerocow@.yahoo.com> wrote in message
news:221ADD36-EA26-45DA-A953-D700866C06F6@.microsoft.com...
> Hi,
> I created a table and filled data to it in ACCESS 2002. How can I migrate
the ACCESS table data to MSSQL 2000 Server? The table in MSSQL DB has
primary key and also has records. I want to append the ACCESS data (2
columns) to the existing table with the same columns names in MSSQL.
> How can I do it?
> Thanks

Migrate ACCESS to MSSQL

Hi
I created a table and filled data to it in ACCESS 2002. How can I migrate the ACCESS table data to MSSQL 2000 Server? The table in MSSQL DB has primary key and also has records. I want to append the ACCESS data (2 columns) to the existing table with the same columns names in MSSQL.
How can I do it
ThanksTom,
you can use the upsizing wizard or DTS. Here are some links to help you:
http://builder.com.com/5100-6388-5059624.html
http://support.microsoft.com/default.aspx?kbid=285829
http://support.microsoft.com/default.aspx?scid=http://support.microsoft.com:80/support/kb/articles/Q237/9/80.ASP&NoWebContent=1
HTH,
Paul Ibison|||Most folks prefer using DTS to the upsizing wizard... However if you do use
the upsizing wizard, go back and ensure that the sql column data types are
appropriate... My experience with the wizard is that it makes the columns
sizes too large.
--
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Tom" <kerocow@.yahoo.com> wrote in message
news:221ADD36-EA26-45DA-A953-D700866C06F6@.microsoft.com...
> Hi,
> I created a table and filled data to it in ACCESS 2002. How can I migrate
the ACCESS table data to MSSQL 2000 Server? The table in MSSQL DB has
primary key and also has records. I want to append the ACCESS data (2
columns) to the existing table with the same columns names in MSSQL.
> How can I do it?
> Thanks

Migrate ACCESS to MSSQL

Hi,
I created a table and filled data to it in ACCESS 2002. How can I migrate th
e ACCESS table data to MSSQL 2000 Server? The table in MSSQL DB has primary
key and also has records. I want to append the ACCESS data (2 columns) to th
e existing table with the s
ame columns names in MSSQL.
How can I do it?
ThanksTom,
you can use the upsizing wizard or DTS. Here are some links to help you:
http://builder.com.com/5100-6388-5059624.html
http://support.microsoft.com/default.aspx?kbid=285829
port/kb/articles/Q237/9/80.ASP&NoWebContent=1" target="_blank">http://support.microsoft.com/defaul...&NoWebContent=1
HTH,
Paul Ibison|||Most folks prefer using DTS to the upsizing wizard... However if you do use
the upsizing wizard, go back and ensure that the sql column data types are
appropriate... My experience with the wizard is that it makes the columns
sizes too large.
Wayne Snyder, MCDBA, SQL Server MVP
Mariner, Charlotte, NC
www.mariner-usa.com
(Please respond only to the newsgroups.)
I support the Professional Association of SQL Server (PASS) and it's
community of SQL Server professionals.
www.sqlpass.org
"Tom" <kerocow@.yahoo.com> wrote in message
news:221ADD36-EA26-45DA-A953-D700866C06F6@.microsoft.com...
> Hi,
> I created a table and filled data to it in ACCESS 2002. How can I migrate
the ACCESS table data to MSSQL 2000 Server? The table in MSSQL DB has
primary key and also has records. I want to append the ACCESS data (2
columns) to the existing table with the same columns names in MSSQL.
> How can I do it?
> Thanks

midian calculation

Hi guys,
I have a dilemma, I used the following query to find the Q-by-q median. It
uses a temporary table. I think it's because it has no index and foreign
key, it takes over 5 minutes to run. When we look at subquestions, there are
over 10,000 records and cross join takes forever. I don't know if I can
create indexes on temp table and wonder if the process will take long
anyway.
--Put the course marks in temp table
--DROP TABLE #QBYQ
CREATE TABLE #QBYQ (QUESTION_ID INT, QUESTION_POINT_MARK DECIMAL)
INSERT INTO #QBYQ
SELECT QM.QUESTION_ID, QM.QUESTION_POINT_MARK
from QUESTION_MARK QM, Question q, Enrollment e
where
e.ENROLLMENT_ID = qm.ENROLLMENT_ID
and q.QUESTION_ID = qm.QUESTION_ID
and e.COURSE_YEAR = 2005
and e.COURSE_SESSION = 1
and e.COURSE_CODE = 'FA4'
--and q.PARENT_QUESTION_ID is null
AND QM.QUESTION_POINT_MARK IS NOT NULL
and q.QUESTION_TYPE_CODE = 'EN'
ORDER BY QM.QUESTION_ID, QM.QUESTION_POINT_MARK
-- It is currently doing statistical median, the smaller of the two if even
rows
-- Get this working first before calculating the financial median (avg of
middle 2 rows)
SELECT Q.LABEL AS QUESTION,
QM1.QUESTION_POINT_MARK AS MEDIAN
from QUESTION Q,
#QBYQ QM1 CROSS JOIN #QBYQ QM2
WHERE QM1.QUESTION_ID = QM2.QUESTION_ID
AND Q.QUESTION_ID = QM1.QUESTION_ID
GROUP BY Q.LABEL, QM1.QUESTION_POINT_MARK
HAVING sum(CASE WHEN QM2.QUESTION_POINT_MARK <= QM1.QUESTION_POINT_MARK
THEN 1 ELSE NULL END)>=(COUNT(*)+1)/2
AND sum(CASE WHEN QM2.QUESTION_POINT_MARK >= QM1.QUESTION_POINT_MARK
THEN 1 ELSE NULL END)>=(COUNT(*)+1)/2
ORDER BY Q.LABEL
I then try to put the select in-line but didn't get the correct results. Can
you tell what's wrong? Looks like HAVING is not doing what it is supposed to
do.
SELECT Q.LABEL AS QUESTION,
QM1.QUESTION_POINT_MARK AS MEDIAN
from QUESTION_MARK QM1, QUESTION_MARK QM2, ENROLLMENT E, QUESTION Q
WHERE
QM1.QUESTION_ID = QM2.QUESTION_ID
AND QM1.QUESTION_ID = Q.QUESTION_ID
AND QM1.ENROLLMENT_ID = E.ENROLLMENT_ID
AND QM2.QUESTION_ID = Q.QUESTION_ID
AND QM2.ENROLLMENT_ID = E.ENROLLMENT_ID
and e.COURSE_YEAR = 2005
and e.COURSE_SESSION = 1
and e.COURSE_CODE = 'FA4'
and q.PARENT_QUESTION_ID is null
and q.QUESTION_TYPE_CODE = 'EN'
GROUP BY
Q.LABEL,
QM1.QUESTION_POINT_MARK
HAVING sum(CASE WHEN QM2.QUESTION_POINT_MARK <= QM1.QUESTION_POINT_MARK
THEN 1 ELSE NULL END)>=(COUNT(*)+1)/2
AND sum(CASE WHEN QM2.QUESTION_POINT_MARK >= QM1.QUESTION_POINT_MARK
THEN 1 ELSE NULL END)>=(COUNT(*)+1)/2
ORDER BY Q.LABEL, QM1.QUESTION_POINT_MARK
ThanksHi Ray5531,
Medians have been discussed many times in this newsgroup. You may want
to google past threads.
Maybe the following two threads help you out:
http://tinyurl.com/7ba4w
http://tinyurl.com/7fsjr
Hope this helps,
Gert-Jan
Ray5531 wrote:
> Hi guys,
> I have a dilemma, I used the following query to find the Q-by-q median. It
> uses a temporary table. I think it's because it has no index and foreign
> key, it takes over 5 minutes to run. When we look at subquestions, there a
re
> over 10,000 records and cross join takes forever. I don't know if I can
> create indexes on temp table and wonder if the process will take long
> anyway.
> --Put the course marks in temp table
> --DROP TABLE #QBYQ
> CREATE TABLE #QBYQ (QUESTION_ID INT, QUESTION_POINT_MARK DECIMAL)
> INSERT INTO #QBYQ
> SELECT QM.QUESTION_ID, QM.QUESTION_POINT_MARK
> from QUESTION_MARK QM, Question q, Enrollment e
> where
> e.ENROLLMENT_ID = qm.ENROLLMENT_ID
> and q.QUESTION_ID = qm.QUESTION_ID
> and e.COURSE_YEAR = 2005
> and e.COURSE_SESSION = 1
> and e.COURSE_CODE = 'FA4'
> --and q.PARENT_QUESTION_ID is null
> AND QM.QUESTION_POINT_MARK IS NOT NULL
> and q.QUESTION_TYPE_CODE = 'EN'
> ORDER BY QM.QUESTION_ID, QM.QUESTION_POINT_MARK
> -- It is currently doing statistical median, the smaller of the two if eve
n
> rows
> -- Get this working first before calculating the financial median (avg of
> middle 2 rows)
> SELECT Q.LABEL AS QUESTION,
> QM1.QUESTION_POINT_MARK AS MEDIAN
> from QUESTION Q,
> #QBYQ QM1 CROSS JOIN #QBYQ QM2
> WHERE QM1.QUESTION_ID = QM2.QUESTION_ID
> AND Q.QUESTION_ID = QM1.QUESTION_ID
> GROUP BY Q.LABEL, QM1.QUESTION_POINT_MARK
> HAVING sum(CASE WHEN QM2.QUESTION_POINT_MARK <= QM1.QUESTION_POINT_MARK
> THEN 1 ELSE NULL END)>=(COUNT(*)+1)/2
> AND sum(CASE WHEN QM2.QUESTION_POINT_MARK >= QM1.QUESTION_POINT_MARK
> THEN 1 ELSE NULL END)>=(COUNT(*)+1)/2
> ORDER BY Q.LABEL
> I then try to put the select in-line but didn't get the correct results. C
an
> you tell what's wrong? Looks like HAVING is not doing what it is supposed
to
> do.
> SELECT Q.LABEL AS QUESTION,
> QM1.QUESTION_POINT_MARK AS MEDIAN
> from QUESTION_MARK QM1, QUESTION_MARK QM2, ENROLLMENT E, QUESTION Q
> WHERE
> QM1.QUESTION_ID = QM2.QUESTION_ID
> AND QM1.QUESTION_ID = Q.QUESTION_ID
> AND QM1.ENROLLMENT_ID = E.ENROLLMENT_ID
> AND QM2.QUESTION_ID = Q.QUESTION_ID
> AND QM2.ENROLLMENT_ID = E.ENROLLMENT_ID
> and e.COURSE_YEAR = 2005
> and e.COURSE_SESSION = 1
> and e.COURSE_CODE = 'FA4'
> and q.PARENT_QUESTION_ID is null
> and q.QUESTION_TYPE_CODE = 'EN'
> GROUP BY
> Q.LABEL,
> QM1.QUESTION_POINT_MARK
> HAVING sum(CASE WHEN QM2.QUESTION_POINT_MARK <= QM1.QUESTION_POINT_MARK
> THEN 1 ELSE NULL END)>=(COUNT(*)+1)/2
> AND sum(CASE WHEN QM2.QUESTION_POINT_MARK >= QM1.QUESTION_POINT_MARK
> THEN 1 ELSE NULL END)>=(COUNT(*)+1)/2
> ORDER BY Q.LABEL, QM1.QUESTION_POINT_MARK
> Thanks|||On Mon, 25 Apr 2005 10:26:30 -0700, Ray5531 wrote:
(snip)
>I don't know if I can
>create indexes on temp table
Hi Ray,
You can. The best way is to use CREATE TABLE to create the table (with
PRIMARY KEY and UNIQUE constraints; accompanying indexes will be generated
automatically), then use CREATE INDEX to add extra (non-unique) indexes,
then use INSERT INTO ... SELECT to load the temp table with data. (This
order of creation minimizes the number of recompiles). OTOH, there might
be cases where definin g an index after loading the table with data might
be quicker - test all variation to find the quickest way in your scenario.
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)

MID() function with SQL

Hello,

I need to select, from a sql database, data from a field and use something like I do in MsAccess: "SELECT field1 FROM table WHERE mid(field1, 5, 3) = 'abc' ".

Is it possible?

Tks

RuiA

Use SUBSTRING function:

SELECT field1 FROM table WHERE substring(field1, 5, 3) = 'abc'

or you could use LIKE operator

SELECT field1 FROM table WHERE field1 LIKE '__abc%'

|||

Hello Mike

Now, I think I was lazy, this one was easy!!

Thank you very much!!!

RuiA

Mid Data Point

I have a database table with 464473 records in it. The file is an opt-in
list. Each record has a unique id number which are not sequential. I need
to split the file in half or find the id number of the mid-point in the
file. At some point I might need to split the file 3 or 5 ways.
HELP. How do i find the mid-point...
I thought that "select top 232237 order by id desc" would show me the id
number. It does not. Any other techniques.William,
If the ID is not sequential and there are possibly gaps in the sequencing,
finding the mid-way point is virtually useless if you are truly trying to
access 50% of the 464,473 row table.
Consider using SET ROWCOUNT:
set rowcount 232236
insert into new_table select * from current_table
delete from current_table
set rowcount 0
"William" wrote:

> I have a database table with 464473 records in it. The file is an opt-in
> list. Each record has a unique id number which are not sequential. I nee
d
> to split the file in half or find the id number of the mid-point in the
> file. At some point I might need to split the file 3 or 5 ways.
> HELP. How do i find the mid-point...
> I thought that "select top 232237 order by id desc" would show me the id
> number. It does not. Any other techniques.
>
>|||I think some clarfications would be useful.
First of all a table isn't a file.
Secondly, what do you mean by "split the file [table?] in half"? That seems
like something quite different from "find the id number of the mid-point".
It would help if you would state your actual goal rather than hinting at
different ideas. If we know what you are trying to achieve we may be able to
suggest better alternatives.
To find the mid-point ID:
SELECT MIN(id) AS mid_point
FROM
(SELECT TOP 232237 id
FROM YourTable
ORDER BY id) AS T
However, I suspect you may be looking for something slightly different, such
as paging or sampling, to which there are likely to be different and maybe
better solutions.
David Portas
SQL Server MVP
--

Friday, February 24, 2012

Microsoft table design best practices

I remember viewing a Microsoft article (MSDN, i think) that gave a detailed
list of Microsoft's best practices for designing database tables. It
mentioned stuff like naming conventions, etc. but I'll be damned if I can
find it again.
Has anyone seen this article?bshewan wrote:
> I remember viewing a Microsoft article (MSDN, i think) that gave a
> detailed list of Microsoft's best practices for designing database
> tables. It mentioned stuff like naming conventions, etc. but I'll be
> damned if I can find it again.
> Has anyone seen this article?
Not from MS, but may give you some ideas:
http://vyaskn.tripod.com/object_naming.htm
David Gugick
Quest Software
www.imceda.com
www.quest.com