Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.databases.ms-sqlserver    |    Notorious Rube Goldberg contraption    |    19,505 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 17,851 of 19,505    |
|    Gert-Jan Strik to jobs@thomassharp.com    |
|    Re: Problem creating string in Computed     |
|    25 Jul 10 18:19:09    |
      0dbdf62f       From: sorrytoomuchspamalready@xs4all.nl              You are on the right track. Where it probably goes wrong is at               "+ (nvarchar(5), JobID)"              You forgot the word CONVERT, as in               "+ CONVERT(nvarchar(5), JobID)"              --       Gert-Jan                     jobs@thomassharp.com wrote:       >       > Hi       >       > I'm fairly novice to SQL Server and am trying to make a computed       > column in my database       >       > I have the following columns in tblJobs :       >       > JobID       > Title       > City       > State       >       > I'm trying to create a computed column that takes the Title and City       > and strips out any spaces and replaces them with a dash, then       > concatenates the other columns with dashes. I also have a numeric       > ID. So if I have       >       > JobID : 22333       > Title : Nurse Assistant       > City : Panama City       > State : FL       >       > and want the resulting string to look like this : Nurse-Assistant-       > Panama-City-FL-22333       >       > I put the following string into the Formula of the Computed Column       > Specification:       >       > Replace(tblJobs.Title," ", "-") + "-" + Replace(tblJobs.City," ", "-")       > + "-" + State + "-" + (nvarchar(5), JobID)       >       > yet the Management Studio says it can't validate this.       >       > Am I on the right track here? Or should I try to do the replace (or       > typecast) somewhere else?       >       > Thanks for any help you can provide.       >       > Paul              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca