Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
php95saj
Starting Member
43 Posts |
Posted - 2002-05-08 : 12:09:36
|
| Can anyone tell me the cast syntax. I am using it to convert a record to 1 or 0 depending on the value returned. This is something what I have:SELECT tblAccountLogins.loginID, tblAccountLogins.Name, CAST(SELECT tblTranslationProfileUsers.loginID FROM tblTranslationProfileUsers WHERE tblTranslationProfileUsers.translationProfileID = 3 AND tblTranslationProfileUsers.loginID = tblAccountLogins.loginID) AS checked AS (Here the CAST VALUE)FROM tblAccountLoginsWHERE customerID = 10The reason to do so is that when I display loginID in an ASP page the checkboxes are checked for which the checked is true or something like that.TIAEdited by - php95saj on 05/08/2002 12:51:02 |
|
|
LarsG
Constraint Violating Yak Guru
284 Posts |
Posted - 2002-05-08 : 12:56:50
|
| The syntax iscast(expression as datatype) So one way of writing your statement isSELECT tblAccountLogins.loginID, tblAccountLogins.Name, (SELECT cast(tblTranslationProfileUsers.loginID as int)FROM tblTranslationProfileUsers WHERE tblTranslationProfileUsers.translationProfileID = 3 AND tblTranslationProfileUsers.loginID = tblAccountLogins.loginID) as checkedFROM tblAccountLogins WHERE customerID = 10 |
 |
|
|
|
|
|