x

query formation

required help in forming the sql query. i have one select statement where i am getting 2 columns i need only one column that is formed after replacement.

 select CAST(RIGHT([file_id],LEN([file_id])-2) AS INT),replace(file_id,'','FR') AS file_id from co_file_tb
more ▼

asked Jul 04, 2017 at 02:54 PM in Default

avatar image

sand143eep
921 40 50 57

Can you provide some sample data and the expected results?

Jul 05, 2017 at 11:01 AM ThomasRushton ♦♦
(comments are locked)
10|1200 characters needed characters left

1 answer: sort voted first

Check if last 2 char of column are int ;) Are you sure that RIGHT([file_id],LEN([file_id])-2) returns INT always ?

more ▼

answered Jul 07, 2017 at 05:40 AM

avatar image

gm_ignat
21 1

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x2221
x1208

asked: Jul 04, 2017 at 02:54 PM

Seen: 231 times

Last Updated: Jul 07, 2017 at 05:40 AM

Copyright 2018 Redgate Software. Privacy Policy