Link to home
Start Free TrialLog in
Avatar of isames
isames

asked on

SQl Query

Can you modify the length of a column for a view?

It seems that the view is inheriting the column parameters from the table it's querying, which it should.
Avatar of Najam Uddin
Najam Uddin
Flag of United States of America image

Not directly but with Cast you can tweak it.

SELECT cast(orginal as varchar(updatedLength)) .....

Open in new window

Avatar of Jim Horn
>It seems that the view is inheriting the column parameters from the table it's querying
Correct.

>Can you modify the length of a column for a view?
Tell us why you want to, as the column data type is already sufficient for the data that's in it.
I you are looking to pad the results to a predetermined length you could cast it from say varchar to char.
But as Jim points out it would be easier to understand what you are trying to achieve in order to give you a more precise answer.
Avatar of isames
isames

ASKER

In my BI software I have linked a two views by a column called Group_Number. When I run the BI worksheet that uses these views, I get an error "Invalid Length Parameters passed to the left"
Please post the T-SQL of your view, then run, then when the error displays double-click on the error message and watch the cursor jump to the offending line, and tell us what line that is.
ASKER CERTIFIED SOLUTION
Avatar of PortletPaul
PortletPaul
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial