Showing posts with label convert. Show all posts
Showing posts with label convert. Show all posts

Wednesday, March 7, 2012

DDL Primer?

Ent Manager is nice, but I need to make some DDL changes to a database
(convert a column from char to varchar, add a new column, etc) with
SQL. Is there a good primer for this? I'm sure it is not too hard, I
just have not had to do this. Thanks.
-JohnElementary cases are well presented in Books Online.
E.g. (to alter a table and/or columns):
http://msdn.microsoft.com/library/d...br />
3ied.asp
ML
http://milambda.blogspot.com/|||...and use Query Analyzer. I forgot to mention.
ML
http://milambda.blogspot.com/|||"John Baima" <john@.nospam.com> wrote in message
news:f17gq1l0e6cted806ef0ub0ab3tflqmlt4@.
4ax.com...
> Ent Manager is nice, but I need to make some DDL changes to a database
> (convert a column from char to varchar, add a new column, etc) with
> SQL. Is there a good primer for this? I'm sure it is not too hard, I
> just have not had to do this. Thanks.
> -John
EM is "nice" but does a lot of "unneccessary" stuff behind the scenes.
When you change a column from Char to Varchar, it actually:
-creates a new table with the new DDL
-copies the data from the original to the new table
-drops the old table
-renames the new table
-drops and recreates constaints
So do you your charges in Query Analyser, like ML suggests.|||Plus - QA won't "assist" you in "clicking up" a potential disaster. :)
ML
http://milambda.blogspot.com/

DDL file to convert from mySQL to SQLServerXXX

We want to migrate a mySQL database to sql server 2000 or sql Server 2005. I have been given a DDL file to perform the conversion, but I don't know what to do with the file? Can anyone help me out? From what I can conclude, the DDL files is a script. So how do I run this script? Where do I place the file, before I run it?

Please help !

IF its a small file (with few tables/storedprocs/views..etc) I would go through the script to check for syntax errors. You could even to a "syntax check" from the query analyzer of SQL Server. Get the script fixed if there are any issues. Then create a database on SQL Server and compile the scripts against the DB.I believe there are SQL Server upgrade/migrate advisors. you can always google and check out any tips.|||

Try this blog and if it work let me know

http://weblogs.asp.net/scottgu/archive/2005/08/25/423703.aspx

DDL Conversion

Hi,

How do you convert DDL statements of SQL Server, which are
generated by DTS into other database vendors' syntax (IBM
DB2 or Oracle)?
Any utility tool?

Thank you,

--jaquesjaquesbosch2@.yahoo.de (Jaques) wrote in message news:<569b197f.0311021228.1602722d@.posting.google.com>...
> Hi,
> How do you convert DDL statements of SQL Server, which are
> generated by DTS into other database vendors' syntax (IBM
> DB2 or Oracle)?
> Any utility tool?
> Thank you,
> --jaques

There are a number of third-party products which can do this - I've
used Embarcadero products for similar tasks, which generally work
well, although they can be expensive. The disadvantage of these tools
is that there will always be some platform-specific data types or
syntax which may not be cleanly scripted because there is no direct
equivalent. So there will usually be some amount of manual
checking/modification required.

Simon|||Hi

If you are using a modelling tool, then this may produce the scripts for the
different database systems.

John

"Jaques" <jaquesbosch2@.yahoo.de> wrote in message
news:569b197f.0311021228.1602722d@.posting.google.c om...
> Hi,
> How do you convert DDL statements of SQL Server, which are
> generated by DTS into other database vendors' syntax (IBM
> DB2 or Oracle)?
> Any utility tool?
> Thank you,
> --jaques

Friday, February 17, 2012

dbms_utility.get_time equivalent in sql server

Hi,
I need to convert the following oracle syntax to sql server:
timevar number;
timevar := dbms_utility.get_time;
This prints : 50989467
I aware of the function getDate() or current_timestamp but they display only the dates and if I convert them to float then the results are not same. Any pointers will be appreciated.
Srik

Hi,

I believe the dbms_utility.get_time routine is used mainly for timing loops. It returns the # of 100ths of a second since "some arbitrary epoch". Therefore, it doesn't have much meaning outside of marking elapsed time.

The SQL Server datetime data type has a resolution of 3.33 milliseconds. You can use the DATEDIFF() built-in function to return the elapsed # of milliseconds between two datetime values. Therefore, it may be something you can use in a way that is similar to Oracle's dbms_utility.get_time routine. Please note that the return type of the DATEDIFF() built-in function is a 32-bit signed integer, which means the the maximum possible elapsed time in millisecond units is equivalent to 24 days, 20 hours, 31 minutes and 23.647 seconds. Anything beyond that will cause an arithmetic overflow.

Here is a sample usage.

declare @.now datetime, @.then datetime
select @.then = getdate()
waitfor delay '000:00:02'
select @.now = getdate()
select datediff(millisecond, @.then, @.now)

Let us know if this answers your question and works for you.

Clifford Dibble
Program Manager, SQL Server

|||Thanks a lot for your response: I have a procedure which stores the dbms_utility.get_time into a localvariable and passes this variable to another procedure. For eg:
timevar number;
timevar := dbms_utility.get_time;
myproc(timevar);

any equivalent syntax will be useful.|||As far as I know, there is nothing directly equivalent to dbms_utility.get_timedbms_utility.getime in T-SQL. You will need to synthesize it using the technique shown in the prior post or you will need to cast the datetime bits using an expression like this:

select cast(cast(getdate() as binary(8)) as bigint)

Regards,
Clifford Dibble
Program Manager, SQL Server