Showing posts with label contains. Show all posts
Showing posts with label contains. Show all posts

Sunday, March 25, 2012

Cant sort a text field!

Hi
ive got a table and contains a surname text field. Why cant i do a select statement ORDER BY surname. I get an error saying i cant sort a text field! how do i go around it!

thanksYou do ANSI SQL ALTER Table and change text to Varchar 40 because text cannot be used for things like name that can be covered with Varchar 40 or 50 at most. Then do ORDER BY. Hope this helps.|||

Your surname filed is a text datatype field which cannot be sorted.

You need change this field to varchar(50) or nvarchar(50) data type to allow you sort on it.

Limno

Wednesday, March 7, 2012

Cant quite figure this one out... any help?

I have 2 tables, one contains the details for all the documents stored on a server such as the documents name and which directory it is stored in, and the other contains the details for each document version (if there are any) these are paired up using the documents id, per example below

Documents
ID, Name, Dir
1, word.doc, /docs
2, excel.xls, /docs
3, webpage.html, /docs

Document Versions
ID
1
1
1
2
2
3

so, as you can see, in the versions table there are 3 versions of 'word.doc' 2 of 'excel.xls' and 1 of 'webpage.html'. i need to write a query that will return all the documents in the versions table who have a matching document in the documents table (that is not the major problem though) the main problem is that i only want to return it if the matching record in the documents table passes certain criteria, this being that it is from a certain site and has a particular type of file name. for example, i would like to return only the document versions whose parent records are '.doc' or '.xls' files, but not html. this would leave me with :

Versions
ID
1
1
1
2
2

leaving the last record out, as it's parent is a html file.

As a bonus, if you could tell me how to append the parents name to each record so i get a table like this :

Results
ID Name
1 'word.doc'
1 'word.doc'
1 'word.doc'
2 'excel.xls'
2 'excel.xls'

that would be great, thank youYou didn't specify database engine you use; but, in Oracle it would be something like this:SELECT d.id, d.name
FROM DOCUMENTS d, VERSIONS v
WHERE v.id = d.id
AND SUBSTR(d.name, INSTR(d.name, '.', 1) + 1, LENGTH(d.name)) <> 'html';
WHERE clause will be different for another requirements, of course.|||hmmm, not sure if that's quite it. and the database engine is SQL server|||As I can't see a generic SQL solution, I'd recommend using:SELECT d.id, d.name
FROM documents AS d
JOIN versions AS v
ON (v.id = d.id)
WHERE d.name NOT LIKE '%.html'-PatP|||Got It! Thanks for your help though. This was the final solution for anyone who's interested

SELECT Docs.Name, DocVersions.TimeCreated, DocVersions.Content
FROM DocVersions INNER JOIN
Docs ON DocVersions.Id = Docs.Id
WHERE (Docs.LeafName LIKE '%.doc' OR
Docs.Name LIKE '%.xls' OR
Docs.Name LIKE '%.ppt' OR
Docs.Name LIKE '%.pdf' OR
Docs.Name LIKE '%.mpp' OR
Docs.Name LIKE ' % .txt ') AND (Docs.DirName LIKE 'sites/archive/%')

I think i confused u all with my talk of leaving out the html document. It wasn't so much i wanted to leave that out as include the others if you know what i mean

Saturday, February 25, 2012

Cant open report...is there an option to open without data?

I've just completed my first Crystal Report, in Crystal 10. The report contains 5 subreports, each of which link to SQL databases. However, I can no longer open the report. When I try to open it, I get the following error message: "crw32.exe has encountered a problem and needs to close. We are sorry for the inconvenience."

I've tried a number of things to resolve, mainly regarding my installation of Crystal Reports, but nothing has fixed the problem. Also, others have tried to open the report and can't, so it seems that the file was corrupted.

I believe the problem first happened when I was adding fields to the report and then attempting to preview the report. I had the "Save Data With Report" option turned on, and I believe the issue is related to changes I made that caused a problem linking to the data. I'm thinking that if I can open the report in Design mode only, without the data, I would be able to undo the changes that started giving me this problem. Is there any way I can open the report without the data now (i.e., turn off the "Save Data With Report" option so I can open up the report with the Design tab only, not the Preview tab, and undo my changes)?

Any input would be appreciated. Thanks much.Visit http://support.businessobjects.com and search for the solution|||I am not any help but I have this same issue when I try to add a field to any of the reports...same error. I am all of a sudden in situation where I cannot add or copy and past a field into the report. If I uninstall and reinstall the situation goes away but only temporarily. I am at my wit's end. If I find out what my problem is, maybe it is related and I will let you know what I find. I have gne from it happening every once in a while to where I am totally unproductive......

Can't open Business Intelligence studio to get at reporting servic

I downloaded sql server express 2005 tool kit which contains Business
Intelligence Studio which is what houses Reporting services. I installed it
but now I can't find where to run it. I re-installed thinking something went
wrong with the install but it says already installed. How can I run this
software'I had the exact same problem . Solution is here:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=362604&SiteID=1
"loulou" <loulou@.discussions.microsoft.com> wrote in message news:FB2D5F2B-712B-466F-B66C-DE9079163B06@.microsoft.com...
>I downloaded sql server express 2005 tool kit which contains Business
> Intelligence Studio which is what houses Reporting services. I installed it
> but now I can't find where to run it. I re-installed thinking something went
> wrong with the install but it says already installed. How can I run this
> software'