I'm looking into a problem a friend is having, and I'll say right off
the bat that I work with with php and MySQL, and not MS SQL.
What he is attempting to do (in MS SQL) is take two database fields
from a table (string fields), multiply them together, and put them into
a third field. This third column in the table has not yet been created
the time of running the query.
If it needs to be multiple queries, that is fine. My first thought is
to use a simple ALTER query to add the column to the table, then to
call a UPDATE function which uses a select statement inside of it. I'm
not sure if something like this can even be done.
// ------------ Suggested query
UPDATE chrisslu SET 'discquantity' = '(SELECT
chrisslu.quantity*chrisslu.nr_of_disc
FROM chrisslu
WHERE (str(period,6)>=? AND str(period,6)<=?))' WHERE
(str(period,6)>=?Andstr(period,6)<=?)
// ------------ End Suggested query
It starts with an UPDATE, but replaces the value to be set with a
SELECT statement. I honestly don't even think this query is
syntactically correct, I'm just trying to get the general concept down
:).
So, question the first: Is this type of query possible? The reason
I'm doing this is because I was told MS SQL has no way of storing
temporary variables... otherwise I would just call a SELECT statement,
store the variable, and UPDATE the new field from the variable after
the ALTER statement.
Second question: If it is possible, am I on the right track, or does
it need to be entered in completely different than what I have?
Third: Regarding the 'type'. Do I need to do any kind of typecasting
or conversion of the fields? Both chrisslu.quantity and
chrisslu.nr_of_disc are string fields (that is what I was told, they
may be varchar of some kind). In order to use them in a math
statement, do they have to be floats, or doubles, or something similar?
I appreciate any response, I know this was a long winded question.
I have a DTS package that transfers some columns defined as varchar(8000).
Sometimes, the values in the columns defined this way have embedded CR/LF in them. When they do, DTS does not always transfer the values to the target.
Is there any way to embed a video in a report? It doesn't seem like it but I thought I may be missing something. Maybe directly editing the xml code? Thanks.
I have embedded tabs in a text field that I want to import to a destination table.
I was thinking I need to replace the tabs with spaces. REPLACE(character_expression,searchstring,replacementstring) Anybody know how to specify ascii in the character expression.If there is a better way I am open to suggestions, however I do not way to remove this in the raw data but handle at transformation time. Thanks,Larry
I've an embedded image (logo) in my report, and in the preview it looks wonderful, but after deploy the logo doesnt appear in the report (report server).
The url of the dead-link-image is http://hamsql1/Reports$BI/Reserved.ReportViewerWebControl.axd?.
I thought that an embedded image is stored "in" the report, but it seems to be an other place. Is it nessecary to deploy an embedded image too? Is it a problem of permissions (i read it in another threat)? How to set these image-see-permission? Or is there an other problem?
I have a Select statement that was working just fine: string sSqlCmd = "INSERT INTO SiloKeywords (Silo_ID, Keyword, UserName) SELECT Silo_ID,'" + Keyword + "', '" + strUsername + "' FROM SiloNames WHERE Silo_Name = '" + Uri + "'"; the PM now wants to capture the internal User, which I have done but I am having real problems with the syntax if the internal User exists:
string sSqlCmd = "INSERT INTO SiloKeywords (Silo_ID, Keyword, UserName, IsInternal) SELECT Silo_ID,'" + Keyword + "', '" + strUserName + "', if EXISTS(SELECT * FROM InternalUsersList WHERE Alias = '" + arrResult[1] + "') 1 ELSE 0 FROM SiloNames WHERE Silo_Name = '" + Uri + "'"; I am completely lost here.
I am trying to find something like a light version of SQL Server 2k to store data for an application that will be distributed through a cd.
Since we also have a web front end for this application when the user is online, we prefer that we can reuse the code for connection on both the cd and the web.
Any idea what will work?
I have come accross MSDE 2k but was not able to find any documentation on the pros and cons for this product regarding its capacity, the type of data it can handle, security, ...
I was wondering if anyone had tried to embed sql server express in a .net application. Specifically, I want to use it from within the app only, similar to embedded mysql (libmysqld) or firebird. I've seen some articles on sql server express saying this can be done, however there is no info on how do to this. Anyone know how it might be done?
Beyond my control: I am finding control characters (likely tab) ismaking its way into address fields of our operational system. This ismessing me up when I load the data into our warehouse w/ BCP (fieldsget shifted).Is the a nifty way to strip control characters from data?TIARob
What I'd like to do is use the result of one query as the input foranother. eg:INSERT INTO foo VALUES ((SELECT id FROM people WHERE name = "bar"),10,'foobar') WHEREid = 1;Problem is, MSSQL wants a scalar value. Is there a way around this?Can someone tell me the correct syntax for what I want to do, or is thissomething that will have to be done outside SQL?Err. Hope I've been clear. Thanks for any help you folks can give.
We have text files that are comma delimited, use double quotes as text qualifiers and sometimes have embedded double quotes. The embedded double quotes are escaped with an additional double quote like: below.
"123","product q"
"124","product ""a"""
DTS 2000 had no problem with this- it correctly parsed the files. The 2005 SSIS file connection manager correctly parses this in preview mode. But when the task is executed the task fails with the message "The column delimiter for column X was not found".
What is the recommended approach for this - we have alot of files in this format.
I have a report with background embedded image. I have placed few textboxes on top of them to display data. Every time I set the location of the textbox, it is behaving strangely by rendering at one location one time and changing location next time when it is rendered. I am viewing it in PDF format.
How can I fix the location of textboxes that renders at one location all the time ?
documentation states, that Windows XP Embedded (XPe) is not supported by any SQL Server 2005 Edition (as I intend to use the Epress Edition on that platform, I post to this forum). So, why is that? Is it just not tested or are there technical reasons for it? What are these reasons? What works and what doesn't on XPe? May XPe be supported in any later version?
Hi i have a video file path stored in my sql database and i have an embedded media player in my web page, how can i load up a different video file into the embedded media player based on movie id or movie name, this is the code i have written so far but im unsure if im in the right direction, thanks
I am trying to modify a piece of SQL where I want to get the date difference from todays date and the datestamp on the latest record on dbo.activitym1 table AC1 ..which matches the following criteria..WHERE (AC1.Type = 'Assignment' or AC1.Type = 'Reassignment') and PS1.number = AC1.number) PS1.number is the master record ID But this doesnt seem to work ..the best result i've been able to achieve is all records from the dbo.activitym1 table that match the where clause and i only want the latest by date heres the code any help would be most appriciatedSelect PS1.number, PS1.brief_description," + " DateDiff(day, PS1.open_time, Getdate()) as 'Days_Open', PS1.company," +" (select DateDiff(day, AC1.datestamp, Getdate())" + " From " + ConfigurationManager.AppSettings["DATABASE_NAME"] + ".dbo.activitym1 as AC1" +" WHERE (AC1.Type = 'Assignment' or AC1.Type = 'Reassignment') and PS1.number = AC1.number) as 'Days_Since_Last_Assigned'," + " CONVERT(VARCHAR(10), PS1.open_time, 103) as 'Date_logged'" + " From " + ConfigurationManager.AppSettings["DATABASE_NAME"] + ".dbo.probsummarym1 as PS1" +
"where (PS1.assignment = 'PROD - UK CENTRAL CPH COGNOS SUPPORT' OR " + " PS1.assignment = 'PROD - UK CENTRAL CPH CONS HEALTH' OR " + " PS1.assignment = 'PROD - UK CENTRAL CPH PUBLICATIONS' OR " + " PS1.assignment = 'PROD - UK CENTRAL CPH TERRITORY PLANNER' OR " + " PS1.assignment = 'PROD - UK CENTRAL CPH VIEWPLUS' OR " + " PS1.assignment = 'PROD - UK CENTRAL EDITORIAL' OR " + " PS1.assignment = 'PROD - UK CENTRAL EDITORIAL CHEMICAL PIONEER' OR " + " PS1.assignment = 'PROD - UK CENTRAL EDITORIAL COMPANY PROFILES' OR " + " PS1.assignment = 'PROD - UK CENTRAL EDITORIAL COMPANY SEARCH' OR " + " PS1.assignment = 'PROD - UK CENTRAL EDITORIAL GENERIC PLNG & ANLYSER' OR " + " PS1.assignment = 'PROD - UK CENTRAL EDITORIAL LIFECYCLE NPF' OR " + " PS1.assignment = 'PROD - UK CENTRAL EDITORIAL LIFECYCLE PATENTS' OR " + " PS1.assignment = 'PROD - UK CENTRAL EDITORIAL LIFECYCLE RDF' OR " + " PS1.assignment = 'PROD - UK CENTRAL EDITORIAL MIDAS GENERICS' OR " + " PS1.assignment = 'PROD - UK CENTRAL FORECASTING ANALOGUE' OR " + " PS1.assignment = 'PROD - UK CENTRAL FORECASTING GENERICS MARKET PROGNOSIS' OR " + " PS1.assignment = 'PROD - UK CENTRAL FORECASTING MARKET PROGNOSIS' OR " + " PS1.assignment = 'PROD - UK CENTRAL FORECASTING OTC REVIEW' OR " + " PS1.assignment = 'PROD - UK CENTRAL FORECASTING THERAPY FORECASTER' OR " + " PS1.assignment = 'PROD - UK CENTRAL GLOB CHEM INTPACK' OR " + " PS1.assignment = 'PROD - UK CENTRAL GLOB CLASSFN' OR " + " PS1.assignment = 'PROD - UK CENTRAL GLOB CORP' OR " + " PS1.assignment = 'PROD - UK CENTRAL GLOB CUSU' OR " + " PS1.assignment = 'PROD - UK CENTRAL GLOB DSG' OR " + " PS1.assignment = 'PROD - UK CENTRAL GLOB GPIN' OR " + " PS1.assignment = 'PROD - UK CENTRAL GLOB INTPRD' OR " + " PS1.assignment = 'PROD - UK CENTRAL GLOB KNOWLEDGELINK' OR " + " PS1.assignment = 'PROD - UK CENTRAL GLOB LICENSING' OR " + " PS1.assignment = 'PROD - UK CENTRAL GLOB LPIN' OR " + " PS1.assignment = 'PROD - UK CENTRAL GLOB MARK SEG' OR " + " PS1.assignment = 'PROD - UK CENTRAL GLOB OTHER' OR " + " PS1.assignment = 'PROD - UK CENTRAL GLOB PRICES FACTORS' OR " + " PS1.assignment = 'PROD - UK CENTRAL GLOB STANDARDS' OR " + " PS1.assignment = 'PROD - UK CENTRAL GLOB WHO' OR " + " PS1.assignment = 'PROD - UK CENTRAL SIT ACCOUNTS' OR " + " PS1.assignment = 'PROD - UK CENTRAL SIT ADMINS' OR " + " PS1.assignment = 'PROD - UK CENTRAL SIT EXEC' OR " + " PS1.assignment = 'PROD - UK CENTRAL SIT HPA CODING' OR " + " PS1.assignment = 'PROD - UK CENTRAL SIT HPA CPMS' OR " + " PS1.assignment = 'PROD - UK CENTRAL SIT HPA PROD CTRL' OR " + " PS1.assignment = 'PROD - UK CENTRAL SIT HPA QUALITY CONTROL' OR " + " PS1.assignment = 'PROD - UK CENTRAL SIT INTL FIELDWORK' OR " + " PS1.assignment = 'PROD - UK CENTRAL SIT IT SOL' OR " + " PS1.assignment = 'PROD - UK CENTRAL SIT PANEL CTRL' OR " + " PS1.assignment = 'PROD - UK CENTRAL SIT PATIENT DATA CODIN' OR " + " PS1.assignment = 'PROD - UK CENTRAL SIT PATIENT DATA PROCESSING' OR " + " PS1.assignment = 'PROD - UK CENTRAL SIT PATIENT DATA QRY & SUPPORT' OR " + " PS1.assignment = 'PROD - UK CENTRAL SIT PRODUCT REFERENCE' OR " + " PS1.assignment = 'PROD - UK CENTRAL SIT PSO' OR " + " PS1.assignment = 'PROD - UK CENTRAL SIT QUALITY ASSURANCE' OR " + " PS1.assignment = 'PROD - UK CENTRAL SIT RESEARCH HOSPITAL GROUP' OR " + " PS1.assignment = 'PROD - UK CENTRAL SIT WARD' OR " + " PS1.assignment = 'PROD - UK CENTRAL SITTINGBOURNE' )" + " and UPPER(PS1.Status) <> 'CLOSED'
I need to insert data in a varchar column to that when its displayed new lines will appear in the text, that is the field will hold text with multiple lines...
Is it true that replacing embedded sql statements (that insert/update and fetch data from sql databases) by stored procedures improves overall respones time and SQL performance. We have tons of embedded SQL statements in our Visual Basic modules and are debating whether replacing them by SQL Stored procedures will really be worht the effort.
Any insights on this?
Thanks in advance. If possible, please reply to my e-mail.Thanks.
Hello, Im doing research for my company for a project we are about to start, but the more I find, the more Im confusing myself. Maybe someone would be so nice to help me a little.
We need a database solution, either licensing (ISV) or i think maybe an embedded database. if its licensing, its not a problem, but after research, im thinking licensing would be a waste of time or too much and theire not enough information to go by just that.
Problem: Need to develop software for a client where there will be around 300 users using the system (not all at once neccisarrily). We are creating this software for them and they want to re-sell it after completion, but they do not want to make their customers purchase a database for the purchase of their software. (because of all types of licensing). We need the database RUNTIME to run on the customers machine to make the software work.
Is there a RUNTIME license for Independant-Software-Vendor(IVS) for redistribution? or would it make sense to embed a database ( for example, the free edition of sql server;embeeded feature :), or maybe firebird embedded database?) We are developing in Visual Studio 2005.
This might sound confusing, thats where im at. For those of you with more experience, hopefully you understand what im talking about.
Thank you. I have 2 days to find a solution. Ill continue looking and post in thread if i find anything new or clearify my problem.
I need to check the value of a column being pulled from an embedded select in the WHERE clause of a script but can't figure out how to do it. The script looks like this:
SELECT LIST_ID, NAME, ADDRESS (SELECT ANSWER FROM VALID_ANSWER WHERE VALID_ANSWER.LIST_ID = VIEW_LIST.LIST_ID) AS ANSWER
FROM VIEW_LIST
WHERE ANSWER = 'No'
The syntax above works in Oracle but in SQL Server I receive the following error: "Invalid column name 'OHIP'."
This is part of a query I have. I want to display the diagnosis code attached to a patient. Sometimes there are more than one which is why I have tried distinct. I am getting the message 'subquery returned more than 1 value...'
If I use MIN or MAX, its giving me the min possible diagnosis code alphabetically or the max, not the one actually assigned to the patient which is what I want.
(SELECT DISTINCT (Diagnosis.DiagnosisCode) FROM Diagnosis LEFT OUTER JOIN CourseDiagnosis ON CourseDiagnosis.DiagnosisSer = Diagnosis.DiagnosisSer LEFT JOIN Course ON Course.CourseSer = CourseDiagnosis.CourseSer JOIN Patient ON Patient.PatientSer = Course.PatientSer WHERE Diagnosis.ObjectStatus = 'Active' AND Diagnosis.Description not like 'ERROR%' AND Diagnosis.DiagnosisTableName not in ('RTDS Dates')),
I want to distinguish between static SQL, dynamic SQL, and embeddedSQL, but couldn't find too much useful resources in the web.For example, if we put SQL statements (SELECT, INSERT, UPDATE, etc...)inside an application (e.g. Java application, VB application, etc...),do we consider those SQL statements as static SQL? or embedded SQL?How about dynamic SQL? any practical examples?Please advise. thanks!!
I inherited an existing database application about 6 months ago. I'vefinished converting it to use SQL Server 2000 as the backend (MS Access2002 frontend w/ Userforms+VBA code pointing to the backend).In its current state the application makes use of a ton of embedded SQLstatements and I'm thinking about the best way to clean this up. Itseems like the best way would probably to encapsulate each of the SQLstatements into its own stored proc and then have the MS Accessapplication call the sp. However, this would result in a very largenumber of stored procedures.Anyone have any links or suggestions regarding best practices onremoving embedded SQL scattered throughout a DB app? Thanks.
My warehouse app employs a distributed architecture. Extractions from disparate (wildly so) systems, and transformations and loads into a standardized schema are performed at various locations close to the source systems (both physically and "logically" speaking). There are security and other reasons for this. However this causes some related design and implementation challenges for the ETL processing.
For one, the ETL processes must be successfully operated by non-technical medical administrators, who actually have little interest in the application and sometimes even the analytics produced by the system, who have other more pressing day to day work they want to be doing, in organizations where turnover is high,training is spotty, and LANs are fragile and often congested.
So, real-time feedback to the operator during processing is pretty dern important. I have built a fairly sophisticated GUI (using .Net forms inside a script component) for the operational interface-input boxes just wouldn't cut it).
But that interface is lacking real time feedback as to processing progress at runtime.
Anyone got that T-shirt yet? I'm thinking I need progress bars and real-time task and component progress reports. Also. is there a way to capture the built in logging output in real-time?
I have a report which has an embedded image in the heading and an image control that loads images from the database (Image control Data section configured as MIMEType=image/jpg, Source=Database, Value=Fields!Img_Data.Value).
In both cases I can see the embedded heading image and the database images in design mode (VS2005) and through the report manager web pages. When I try to render the report through the ReportViewer web control in my web application, the images do not display (standard missing image red "X" appears).
I have a button on my web form which re-runs the report and exports it to PDF, and when pressed the report is displayed correctly in PDF with all images.
What do I need to do to the ReportViewer web control for it to show embedded and database images? I am using the ReportViewer for 2005.
In my report, I have a table with a nested group. The inner most group contains a column with values that are dynamically calculated in the report. I would like the outer group to display the sum of the inner group values. However, the outer group does not have access to the inner group scope.
As a solution, I am attempting to use the method detailed at this site:
Essentially, the method is to declare a hash table in the embedded code where data can be stored. I slightly modified the code to the following:
Code Block Public Dim hashTable as new System.Collections.HashTable
function setValue(key As Object, value As Object) As Object If (Not hashTable.ContainsKey(key)) Then hashTable.Add(key, value) Return value end Function
function getValue(key As Object) As Object If (hashTable.ContainsKey(key)) Then Return hashTable(key) Else Return Nothing end Function
function sumRunningValue(key As Object, value As Object) As Object If (Not hashTable.ContainsKey(key)) Then hashTable.Add(key, value) Else hashTable(key) = hashTable(key) + value Return hashTable(key) end Function
Inside the inner scope everything works great and I can even get the runnning value. But the reason I did this was to be able to access the value in the outer group. But, it doesn't work! When I call Code.getValue(key) I get Nothing back.
So, it seems this is a scope issue. Is anyone aware of a work around for this problem. Is it possible to declare the hashtable with a global scope, for instance? Is the code redeclared for every new group?
I can not completely understand how to deploy sse with my application
To some degree I understand the explaning in Mikes Documentation
Things I don't get:
1)Do I not check the prerequisite server express because when I did and run the setup.exe that I build the thing that happens is that the sql package gets unpacked over and over along with a little message that it's taking a little longer then expected. I gues this is the fallpit where the actual setup.exe for sse is nothing being done with hence the wrapper.
A quote from Mikes document "If the VS Bootstrapper isn't flexible enough for you then". Well, I don't know what I'am doing wrong but it doesn't work at all. I had no problem with the other prerequisites (Framework, installer)
Back to the first question: if so do I manually add the SQLEXP.EXE (downloaded from the internet) or is it the sqlexpr32.exe in the same folder as the setup.exe for the application?
2) How is the wrapper invoked? I don't see that mentioned. I thought when you start the application itself, but that hardly seems logical.
Please anyone, give me some clear directions or additional expanatory
What is the feature Matrix for the recent SQL Server 2005 for SBS update? I specificly had the update installed to get SQL Server 2005 and utilize the new Database Mail, and the CLR functions. Where is it that it says.. btw, no Database Mail for you SBS chump!... Oh.. and well, you have to buy a new server and a full license of SQL Server 2005 to access smtp and send html email. I'm a little irrate about this, I advocate for MS technology every day and don't like getting bit in the *** reading SQL Server 2005 marketing materials and then recieving its retarded cousin for my SBS server. Hey,, charge me a little more money. Just put in a reasonable feature set. So, as far as can tell so far. No CLR coding and no Database mail, its like the body with no arms and no legs, but a better heart, pumping blood to nowhere.
Someone please tell me I'm ignorant and lazy and point me to how I can get these features working with investing 10,000 for a simple html email trigger.
On another thread a poster suggested that you can experience performance gains in Ssis by not using stored procedures.
I asked if I could have some Microsoft articles that articulated this position, but received no response.
Does anyone have links to Microsoft supported articles articulating when/if it is appropriate from Ssis to Not exec Stored Procedures for data manipulation or data collection?