Author |
Topic |
Warmar
Starting Member
7 Posts |
Posted - 2013-07-02 : 04:07:00
|
HiThis is my first post on this site and i realy hope you could help me. I need a sql code that take this series of numbers66425940110 to the four last four numbers 0110. I wrote this code Right$( str , num )but is dident take the first 0 in. The result was 110 which isent good enought. I need it so say 0110. In exampels with no 0 the result is what i whant for exampel66425981565 which makes it 1565. This is how i whant it to be even in numberseries with 0.This sql code is for a mapmaking program cald mapinfo. /Warmar |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-07-02 : 04:13:42
|
in SQL Server you can do like this.SELECT RIGHT(CAST(YourColumn AS varchar(20)),4) AS YourValue FROM YourTable ------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
 |
|
Warmar
Starting Member
7 Posts |
Posted - 2013-07-02 : 04:27:23
|
i tryed but it dident work. Im kind of new on this. Could you write what exact to write?I got some some notes frome i co worker that is on semester now which goes like this. "Mid$(mycolumn),X4) Is that right? There is something wrong with is beacuse it dosent work for me :S |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-07-02 : 04:29:10
|
quote: Originally posted by Warmar i tryed but it dident work. Im kind of new on this. Could you write what exact to write?I got some some notes frome i co worker that is on semester now which goes like this. "Mid$(mycolumn),X4) Is that right? There is something wrong with is beacuse it dosent work for me :S
I'm not sure whether you're using SQL Server. The syntaxes of code you posted so far is not T-SQL. So please tell us which RDBMS you're using------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
 |
|
Warmar
Starting Member
7 Posts |
|
Warmar
Starting Member
7 Posts |
Posted - 2013-07-02 : 04:39:12
|
Since the program isent only a database program. It is mainly a mapmaking program which connect databse info to a visual map |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-07-02 : 04:43:10
|
quote: Originally posted by Warmar Since the program isent only a database program. It is mainly a mapmaking program which connect databse info to a visual map
Then you may be better off posting it in some application spefic forum for mapinfoThis is a SQL Server forum and we deal with only database specific problems in SQL Server.------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
 |
|
Warmar
Starting Member
7 Posts |
Posted - 2013-07-02 : 04:43:36
|
Okey. Thanks for help ! |
 |
|
Warmar
Starting Member
7 Posts |
Posted - 2013-07-02 : 05:09:46
|
I think i know what you whanted to know now. "The MapInfo SQL Language is based on the SQL-3 and SQL/MM standards. String literals must be enclosed in single quotation marks ('example') while identifiers (column names, table names, aliases, etc) should be enclosed in double quotation marks ("example identifier") if necessary. Identifiers only need to be quoted if the parsing logic is unable to correctly parse the identifier. This would include identifiers that have spaces in their names or other special characters. Does is help? |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-07-02 : 05:25:23
|
quote: Originally posted by Warmar I think i know what you whanted to know now. "The MapInfo SQL Language is based on the SQL-3 and SQL/MM standards. String literals must be enclosed in single quotation marks ('example') while identifiers (column names, table names, aliases, etc) should be enclosed in double quotation marks ("example identifier") if necessary. Identifiers only need to be quoted if the parsing logic is unable to correctly parse the identifier. This would include identifiers that have spaces in their names or other special characters. Does is help?
Not muchAs i still dont know what all are string functions it will support, its syntax etc------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
 |
|
Warmar
Starting Member
7 Posts |
Posted - 2013-07-02 : 05:29:10
|
http://reference.mapinfo.com/software/mapinfo_developer/english/1_0/misql/introduction/commands.html is the source |
 |
|
chbala85
Starting Member
49 Posts |
Posted - 2013-07-02 : 06:20:51
|
find belowdeclare @Column bigintset @Column=3728990030072SELECT RIGHT(CAST(@Column AS varchar(20)),4) |
 |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-07-02 : 06:22:55
|
quote: Originally posted by chbala85 find belowdeclare @Column bigintset @Column=3728990030072SELECT RIGHT(CAST(@Column AS varchar(20)),4)
how is this different from what I posted 2 hours ago?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
 |
|
|