I'm working on a stored procedure that works fine. I just want to make it possible for the user to be able to have a drop down list in reporting services to display the "question codes" grouped by whatever the first two digits are. for example.
VT01 VT02 VT03 VN01 VN02 VN03 ST01 ST02 ST03
instead of listing everything, i want the viewers to see this VT VN ST or an alias for each of these like this:
Vet Tasks Vet National Survey Tasks Survey National
any ideas, here's my current code, which is pullin up anything with the added substring part
Code Snippet ALTER PROCEDURE [dbo].[Testing_Questions] (@Region_Key int=null,@QuestionCode char(5)) AS BEGIN
SELECT dbo.Qry_Questions.Territory, dbo.Qry_Questions.SalesResponsible, dbo.Qry_Questions.Customer, dbo.Qry_Questions.Date, dbo.Qry_Questions.StoreName, dbo.Qry_Questions.PostCode, dbo.Qry_Questions.Address2, dbo.Qry_Questions.[Question Code], dbo.Qry_Questions.Question, dbo.Qry_Questions.[Response Type], dbo.Qry_Questions.response, dbo.Qry_Questions.sales_person_code, dbo.Qry_Sales_Group.Region_Key, dbo.Qry_Sales_Group.Region FROM dbo.Qry_Questions INNER JOIN dbo.Qry_Sales_Group ON dbo.Qry_Questions.sales_person_code COLLATE SQL_Latin1_General_CP1_CI_AS = dbo.Qry_Sales_Group.SalesPerson_Purchaser_Code WHERE REGION_KEY=@Region_Key AND SUBSTRING(dbo.Qry_Questions.[Question Code],0,3)=@QuestionCode
I would like to perform a procedure which takes a string of numbers and searches for strings in a table which include all the given numbers in any particular order. problem is i can only return strings which include 'any' of the letters in the search string and not 'all'.
this is how i perform it so far:
SELECT Phone AS [Telephone Number]
FROM tbl_Person AS p
WHERE (p.Phone LIKE '%[' + @IncludeNumbers + ']%')
(ive removed some unecessary bits but this shows the basics)
As you can see currently it will return any phone numbers which contain any numbers given in the includeNumbers string, I would only like it to return phone numbers which contain all the numbers given in the includeNumbers string. is there any way to make it search for strings which include 'all' numbers given?
I'm writing to ask if anyone knows whether or not MS SQL server stores in any system tables the association between a database and the drive letter/directory path where its corresponding MDF/LDF files are located.
Hi. I'm looking for tutorials on how to use SSRS 2005 to generate letters in Word or PDF format from a database. We need to send letters with our company logo and some boilerplate text to a set of companies based on a SQL Server query. So the letter will look something like this, with the red areas repeating from the dataset,
[logo goes here]
123 Any St. AnyCity, CA 90210
Dear [name from database],
Some boilerplate text goes here. Your Account [account number from database] is past due.
Ho can I convert first letters of a string to Upper Case (i.e. UNITED KINGDOM - Untited Kingdom). I have country names table which has all entries in uper case. This makes a select box very larg and unproportional. Thanks in advance for the help.
Can you restore the master database, running on windows server 2000, sqlserver 2000 from a backup that was taken from c: to another serverrestoring to d:?*** Sent via Developersdex http://www.developersdex.com ***Don't just participate in USENET...get rewarded for it!
The first 3 digit are company codes and pretty unimportant to this problem. As you can see, 111q0002 has three versions. A, B, and no letter. The most up to date is B. So in this list I want to list only the most up to date quotes. So the resulting list would be:
111q0001 111q0002B 222q0005
Get it? Good, cuz I have no idea how to query that... any help at all is appreciated!
I'm using MS SQL Server 2k and scripting with ASP 3.0
As part of a migration of data to a new SAN I have hit a bit of a snag in the migration. In summary what will happen is user database data files will be moved from one LUN (say drive F:) to a new LUN (say drive G:). Once all the data is migrated, plan is to remove dependency of that drive from SQL server and remove the drive and delete the LUN. So far, so good.
However one of the LUNs (drive D:) destined to be deleted also hosts the instance default directories, i.e. everything under MSSQL11.MSSQLSERVER (Data, Backups, FTData, JOBS, etc). BOL has articles on how to migrate system databases, including tempdb. But there is no guidance that I could find on how to relocate other folders. There are forums where users have listed registry changes, etc that can achieve this but these are steps I am unwilling to take on a production server.
So my plan is: 1) Add new drive to cluster (drive E:), sufficiently large enough to host instance default folders 2) Shutdown SQL server 3) Copy all default folders to new drive 4) Swap drive letters so that new drive is now D: 5) Start SQL server and if everything works, delete the original drive (which is now drive E:).
Hello - I have a SQL 2000 server which has a D: drive that contains all of my databases (system and user). I am running out of space on this volume and need to migrate the contents of this volume to a larger one. My initial plan was to introduce a new volume to the server (say a K: drive). Backup all databases (of course), and then stop all SQL services. Copy all data from D: to K:. Once data is copied, swap drive letter names (D: to I: and then K: to D. Then restart SQL services. SQL should not know any better since everything was on the D: drive when it went down, and everythiing is still on the D: drive when it came back up, correct?
The other option mentioned is to detatch the databases, copy the data and then reattach them in their new locations. I understand this method, but it seems more involved (and riskier) than just renaming the drives. Does anyone have an opinion regarding these two migration methods? Thanks for your help.
Hello all, started working on a website in ASP that use mssql, i am trying to store large ammount of text, for now its just 10kk letters, the data type is set to text in the mssql db, but when i read it back from the db, i only get 7.7k letters, i know its not an ASP problem cause i print the var holding the content before storing it in the db.
my question is, is there a way to change the text length limit in mssql, or use another data type?
Thanks, Gilad Darshan
EDIT: forgot its saving the html source with the style and not only the words. fixed to the right amount of letters