Solved

Select and convert to string

Posted on 2013-11-12
2
362 Views
Last Modified: 2013-11-12
I am using a dreamweaver extension to export data to excel but it has a bug and gives an error upon a large number.
Workaround is to select the fields for the recordset and convert them into 'string' so that the error is avoided, they said I should add "number" (quotes) before and after the number.

How can I do this ?  this is my select statement:

--

SELECT a.UserId, a.UserType, a.FirmId, a.EmployerId, a.LastNm, a.FirstNm, a.DobD, a.SSN, a.Email, a.Nationality, a.NiStatus, a.ExpiresOnD, a.Docstatusstat, a.NIVMaxStatus, a.I94DateD, a.I94, a.I797Date, a.I797, a.EadDate, a.Ead, a.ApDate, a.ApNum, a.Iap66Date, a.Iap66, a.GcDate, a.GC, a.I20Date, a.I20, a.PpExpireOnD, a.PpNum, a.PobCountry, b.MaidenNm as Employer, d.MailStr + ' ' + d.MaidenNm as Attorney, a.PobCountry, a.archivedcont, a.contactstatus, a.Docstatusstat, e.Docstatdesc,a.Dswg, a.VisaExp, a.VisaType, a.VisaStatus
FROM users a Left join users as b on a.employerid = b.userid Inner join attscont as c on a.userid = c.userid Inner join users as d on c.attyid = d.userid left join Documentstatus as e on e.documentstatus = a.Docstatusstat
WHERE a.usertype = 'contact' and a.firmid = MMColParam AND d.userid = MMColParam2 AND a.Archivedcont LIKE 'MMColParam3' and a.Contactstatus LIKE 'MMColParam4' AND ISNULL (a.FirstNm,'') LIKE 'MMColParam5%' and ISNULL (a.LastNm,'') LIKE 'MMColParam6%' and ISNULL (a.SSN,'') LIKE 'MMColParam7%' and ISNULL (a.email,'') LIKE 'MMColParam8%' and ISNULL (a.Nationality,'') LIKE 'MMColParam9%' AND ISNULL (a.Nistatus,'') LIKE 'MMColParam10%'
ORDER BY MMColParam500

--
0
Comment
Question by:amucinobluedot
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 5

Accepted Solution

by:
dannygonzalez09 earned 500 total points
ID: 39642056
you can do this to convert a numeric or integer column to string

SELECT '"' + CONVERT(VARCHAR(10),IntegerColumnName) + '"'

what i'm doing here is inserting " (double quotes with in single quotes) and concatenating it with integer column convert to a string

change the integerColumnname with your numeric or integer column and you can also change the length to what ever you want ex: VARCHAR(10) to VARCHAR(50)
0
 

Author Closing Comment

by:amucinobluedot
ID: 39642102
:)
0

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question