SQL In The Embedded Code
Mar 21, 2007Is it possible to have a sql select statment in the embedded code in a report?
View 5 RepliesIs it possible to have a sql select statment in the embedded code in a report?
View 5 Replies
Hi all,
Could someone tell me if custom code function can capture the event caused by a user? For example, onclick event on the rendered report?
Also, can custom code function alter the parameters of the report, or refresh the report?
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'
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:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1129743&SiteID=1
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?
Thanks for any assistance,
Tyler
I have a problem in which I would like to use the value of the togglestate property for textbox in embedded code to drive some other logic.
My first question is, "Can it be done?" and if so, how?
Hi,
I was wondering if there's a way to connect to a shared datasource in the Code section of a report's properties. I want to connect using my shared datasource as defined in my solution and query it to return a value based on user input for a function I need to put there.
Thanks,
Greg
Hi,
I have a problem that seems impossible to resolve in RS but i need to be sure.
I'm creating an Embedded Code in VB of course, and i need to run a query within my code to be able to continue the rest of the code depending on the result of my query.
The problem is there is no adodb.recordset or adodb.connection like in normal VB.
So i created my query like as string:
Dim Sql as String
Sql="Select ..." into "from ........where...."
At this point if it was in normal VB,
i would do
MyConnection.Execute(SQL)
and then i will get the answer in my recordset.
I need to know if there is a way in RS to run my query since I cannot use use adodb ....
If it's not really possible, is there way to go around this problem????
Thanks for the Help
Mike
Wonder if somebody know if it exist som tools that makes it possible to geta graphical overview of relationships between C# source code components andtheir's interaction with the database tables/elemts (E.g SQL serverdatabase)A typecial rewengineering tool to get a grasp of a system with manycomponents acessing multiple tables in a rdm system.A tool that parses the C# code for sql/(databse interaction) and presentsthe interaction grahical in som way?Many thanksAksel
View 3 Replies View RelatedI 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.
Any idea why? Workarounds? TIA.
Why is using an embedded SELECT statement faster than using an embedded UDF that has the same exact SQL code within?
Example (not syntax corrected)
Ex1:
SELECT myValue1, myValue2 FROM myTable WHERE aValue = (SELECT Value FROM someTable WHERE myIndex = 800)
is much faster than something like
Ex2:
SELECT myValue1, myValue2 FROM myTable WHERE aValue = (dbo.FN_myUDF(@vmyIndex))
Given that dbo.FN_myUDF has the same code as the embedded select in the first example.
TIA,
KB
I'm looking into a problem a friend is having, and I'll say right offthe 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 fieldsfrom a table (string fields), multiply them together, and put them intoa third field. This third column in the table has not yet been createdthe time of running the query.If it needs to be multiple queries, that is fine. My first thought isto use a simple ALTER query to add the column to the table, then tocall a UPDATE function which uses a select statement inside of it. I'mnot sure if something like this can even be done.// ------------ Suggested queryUPDATE chrisslu SET 'discquantity' = '(SELECTchrisslu.quantity*chrisslu.nr_of_discFROM chrissluWHERE (str(period,6)>=? AND str(period,6)<=?))' WHERE(str(period,6)>=?Andstr(period,6)<=?)// ------------ End Suggested queryIt starts with an UPDATE, but replaces the value to be set with aSELECT statement. I honestly don't even think this query issyntactically correct, I'm just trying to get the general concept down:).So, question the first: Is this type of query possible? The reasonI'm doing this is because I was told MS SQL has no way of storingtemporary variables... otherwise I would just call a SELECT statement,store the variable, and UPDATE the new field from the variable afterthe ALTER statement.Second question: If it is possible, am I on the right track, or doesit need to be entered in completely different than what I have?Third: Regarding the 'type'. Do I need to do any kind of typecastingor conversion of the fields? Both chrisslu.quantity andchrisslu.nr_of_disc are string fields (that is what I was told, theymay be varchar of some kind). In order to use them in a mathstatement, do they have to be floats, or doubles, or something similar?I appreciate any response, I know this was a long winded question.Chris
View 9 Replies View RelatedHey everyone,
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.
-Keith
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
Hi there!
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?
Every idea is very welcome!
Thanks,
Torsten
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.
Thanks for any help
Hi,
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, ...
Please give me some pointer.
Thanks very much.
Baoha.
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?
View 1 Replies View RelatedBeyond 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
View 1 Replies View RelatedWhat 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.
View 2 Replies View RelatedWe 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.
thanks
Hi,
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 ?
Thanks,
Shyamkumar123
Hi,
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?
thanks,
Matthias
I am building a mobil application using Windows XP embedded. I need a database that will run on xp embedded as follows:
Client mode: Sometimes connected to server(local) sometimes disconnected.
Server Mode: Ready access to database from client and system running server.
Client must be able to switch to server mode in event of failure.
Does SQL Mobile support running Windows XP embedded on the Server?
Does SQL Mobile support running Windows XP embedded on the Client?
Does SQL Mobile support running Windows XP embedded in a failover mode?
If it does not support this type of operation then what mobile database will support XP Embedded in all modes stated above?
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
View 2 Replies View RelatedHello Pros
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...
what's the most efficient way to do it ??
Any help will be highly appreciated,
What is the best way to query for columns which contain embedded carriage returns?
View 2 Replies View RelatedIs 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!!
View 4 Replies View RelatedI 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.
View 1 Replies View RelatedMy 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?