Showing posts with label memory. Show all posts
Showing posts with label memory. Show all posts
Friday, February 10, 2012
cast ( host_name() as int )
hi. i'm new to sql server administration.
i need to migrate a table that has field (from memory)
uid INT DEFAULT CAST(HOST_NAME() AS INT)
the current table has field values that r integers
new table of same structure is blank
trying to export the data to new table i get error saying some thin
like
cannot convert RIYAZM (computer_name) to int
seems to be converting the host_name value to int without actually
checking that there is an actual integer supplied!!!
how to solve this?
thanx
riyazWhy would you want to have a machine name in an int columns which also is na
med uid? Talk to the one
who did this data model, as it seems screwed up. Short story is that you can
not input anything which
isn't castable to an int into an int column.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
<rmanchu@.gmail.com> wrote in message news:1146991157.328130.266300@.g10g2000cwb.googlegroups
.com...
>
> hi. i'm new to sql server administration.
> i need to migrate a table that has field (from memory)
> uid INT DEFAULT CAST(HOST_NAME() AS INT)
> the current table has field values that r integers
> new table of same structure is blank
> trying to export the data to new table i get error saying some thin
> like
> cannot convert RIYAZM (computer_name) to int
> seems to be converting the host_name value to int without actually
> checking that there is an actual integer supplied!!!
> how to solve this?
> thanx
> riyaz
>|||(rmanchu@.gmail.com) writes:
> hi. i'm new to sql server administration.
> i need to migrate a table that has field (from memory)
> uid INT DEFAULT CAST(HOST_NAME() AS INT)
> the current table has field values that r integers
> new table of same structure is blank
> trying to export the data to new table i get error saying some thin
> like
> cannot convert RIYAZM (computer_name) to int
> seems to be converting the host_name value to int without actually
> checking that there is an actual integer supplied!!!
> how to solve this?
As Tibor said, this is completely wretched. Maybe the person who
designed the database worked from the assumption that all machine
names were numeric.
Or the memory you are working from is not correct. There is a host_id()
function, maybe that is what is in the default constraint.
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||had a talk with the programmer. he's using WSID=# in the connection
string to set the int, different values for different users.
the original tables are fine => it contains ints in those fields.
the method does seem wierd, i guess its a short cut to do something
internal.
but i don't see a reason why the export will not work!
the field contain ints => implies the default value should not be
invoked! just insert the existing value.
perhaps my thinking is wrong.
thanx
riyaz|||the Enterprise Manager - during connect to the SQL Server - does not
allow additional options to be set?
i'd like to test using the setting WSID=#
riyaz|||You can connect using OSQL or SQLCMD, specifying a name for the machine usin
g one of the
command-line switches.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
<rmanchu@.gmail.com> wrote in message news:1147059568.367462.322520@.i40g2000cwc.googlegroups
.com...
> the Enterprise Manager - during connect to the SQL Server - does not
> allow additional options to be set?
> i'd like to test using the setting WSID=#
> riyaz
>|||(rmanchu@.gmail.com) writes:
> had a talk with the programmer. he's using WSID=# in the connection
> string to set the int, different values for different users.
> the original tables are fine => it contains ints in those fields.
> the method does seem wierd, i guess its a short cut to do something
> internal.
> but i don't see a reason why the export will not work!
> the field contain ints => implies the default value should not be
> invoked! just insert the existing value.
> perhaps my thinking is wrong.
I've never used the export stuff in Enterprise Manager, so I have
no idea what it is up to. But I agree that it sounds funny that rhe
default gets in the way.
Could it be that columns are not in the same order in the source and
target tables? (This is just wild speculation.)
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||columns r in the same order.
have given up on an automated migration
am using enterprise manager to import to a tmp "results" table in the
new database, one table at a time.
after that
insert into newdb_table (columnnames)
select columnnames from results
it works => default values do NOT get in the way but to say its tedious
is ... is an understatement!
thanx
riyaz
Subscribe to:
Posts (Atom)