Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Spatial data type and Varchar(100)
Message
From
20/11/2011 16:26:32
 
General information
Forum:
Microsoft SQL Server
Category:
Other
Environment versions
Environment:
VB 9.0
OS:
Windows 7
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01529320
Message ID:
01529325
Views:
24
>No, when you define it as Varchar(100) you still can enter only 100 chars maximum.
>If you want to use CHAR(100) you just need to change the convert and use varchar() there. Then it will work also.
>
>GeographyTemporary -> CHAR(100)
>
>-- That should work:
>UPDATE ... SET ...
>           GeographyTemporary='POINT('+CONVERT(varchar(100),Longitude)+' '+CONVERT(varchar(100),Latitude)+')'
>
>Because I doubt the Longitude or Latitude can exceed 100 chars each when you convert them.
>When you convert something to VARCHAR SQL Server converts it and remove all trailing spaces. When you convert it to CHAR() SQL Server add trailing spaces to match the length of the field.

Thanks, then, the maximum values for those would be:

POINT(-999.99999 -999.99999)

which would means that Char(28) would be big enough. Then, at the code level, as you mentioned, I would kept the usage of Varchar(100) just to have a proper conversion which would remove the trailing spaces and that should fit.

Is this pretty much the maximum optimization I could do here if I would want to keep the field definition to its minimum declaration?
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform