You created PID as a synonym in the SELECT statement, you should be able to use 
it in the where clause.  I am sure I have done that before in the past with SQL 
Server.

Regards

David Jordan

-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of George Gallen
Sent: Thursday, 29 December 2011 7:09 AM
To: U2 Users List
Subject: Re: [U2] MS-SQL Question

That didn't work because it is not a virtual column defined in the table 
layout. What I did was Created a variable in my program that contained the full 
string, and when I was creating the SQL String to pass to the server, I used 
the variable name instead.

It worked in the sense, I didn't have to retype the string multiple times, but 
the SQL query that Was passed to the MSSQL machine did have it multiple times 
still, but at least it's more manageable
>From a programming standpoint, where I only have to make changes to one spot.

George

-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of David Jordan
Sent: Wednesday, December 28, 2011 3:04 PM
To: U2 Users List
Subject: Re: [U2] MS-SQL Question

You should be able to just use "PID" in the where clause.

David Jordan

-----Original Message-----
From: u2-users-boun...@listserver.u2ug.org 
[mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of George Gallen
Sent: Thursday, 29 December 2011 2:51 AM
To: U2 Users
Subject: [U2] MS-SQL Question

I'm querying a sequel server , I have a column in one table that the data is in 
the form of "X|Y|Z".

I have the following in my SELECT:

substring(colname ,charindex('|',colname)+1, charindex('|',colname, 
charindex('|',colname)+1) - charindex('|',colname) -1) as "PID"

Is there anyway that I can then use the "PID" designation  in a where clause, 
without having to retype the string again?


I can't add a virtual column to the table , and I can't add a procedure either.

_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users
_______________________________________________
U2-Users mailing list
U2-Users@listserver.u2ug.org
http://listserver.u2ug.org/mailman/listinfo/u2-users

Reply via email to