Blank values returned from SQL Server Convert to Query Template
I am attempting to migrate Query Templates from Oracle to SQL Server. In the Oracle version I am using TO_CHAR to convert a date to a particular string format. To return the same string format in SQL Server I have to use CONVERT. The TO_CHAR returns a value which is displayed by the Query Template Test function. However, in the case of the CONVERT a blank is returned even though it works perfectly well when I run the same query in SQL Server Management Studio. Can anyone tell me why is this happening or suggest a fix? Thanks. John.
John,
Glad that did the trick.
Native client tools like SQLPlus, Toad, Query Analyzer, etc. will often not care about column names, sometimes labelling the column as the full messy expression and sometimes calling it Expr1, but when doing aggregate expression or conversion type columns in an MII query you should adopt the habit of aliasing the columns in the query.
What a better way to control the situation than to dictate it in your request
Regards,
Jeremy
Similar Messages
-
Using values returned from SQL for Report column names
I am building reports against our TFS development db.
One of the reports tracks days spent (Dwell Time) in various status categories (eg: New, Assigned, In Development, Hold, etc) for a given "ticket".
For a fixed list of values from {Work Item].System_State, I can send the results (days in Assigned) to the column named (Assigned) for each status for each event in the [Work Item History], and then sum them for each ticket as:
Ticket ID New Assigned InDev etc
1230001 2 0 0 ...
1230001 0 1 2 ....
SUM 2 1 2 ....
However, I have many different Projects, each of which use their own Status names.
I don't want to duplicate the same basic report, if I can avoid it.
How can I name and generate this data for the unique Status list for each Project?
Simplest analog is: name = First(Fields!Status.Value, "TFSdb")
and allows value for a column name (category) as: =IIF(Fields!Status.Value = First(Fields!Status.Value, "TFSdb"), Fields!Days.Value, 0)
However this fails beause:
1. It only delivers the FIRST status value, and,
2. I cannot SUM an expression which is itself an aggregate (using First).RRapport,
Is this still an issue?
Thanks!
Ed Price, Power BI & SQL Server Customer Program Manager (Blog,
Small Basic,
Wiki Ninjas,
Wiki)
Answer an interesting question?
Create a wiki article about it! -
The SQL statement is not valid - when importing data from SQL Server using a query
Hi there,
I am trying to import data from SQL to Power Pivot using a SQL query like below:
SELECT Score.FieldCount, Score.Record.GetAt(0), Score.Record.GetAt(1), Score.Record.GetAt(2), Score.Record.GetAt(3), Score.Record.GetAt(4)
FROM
SELECT * FROM dbo.CLR1(
dbo.CLR2('c:\FILES\Test.xml'),
'SELECT * FROM [dbo].[CXCustomer_Small]') Input
) Score
And when I tried to validate it, it returns
The SQL statement is not valid. A column name cannot be blank.
I ran the above SQL statement in Management Studio and it works without problem. Any idea?
Thanks!
Chu
-- Predict everything. http://www.predixionsoftware.comNever mind, I figured out - I need to give each column a name.
-- Predict everything. http://www.predixionsoftware.com -
Problems when trying to import metadata from SQL server using OWB
Hi,
We are using Oracle 11.2 EE on AIX and OWB: 11.2. We are in the process testing Oracle Transparent gateway for SQL Server and have installed and configured it on a standalone windows server. We and have run the ORACLE_HOME\dg4msql\admin\dg4msql_cvw.sql on SQL Server side, in order to query the SQL-Server data dictionary. We have created a DB-link and can pull data correctly without any problems. When trying to import metadata in OWB Client on win xp, we have created a non-oracle SQL Server Module and are able to connect and start the import, but the displayed table names look strange and can not be imported. In front of every letter there is a square box, so instead of ADDRESS (the address table in the source system) , it reads "squarebox"A"squarebox"D"squarebox"D"squarebox"R"squarebox"E"squarebox"S"squarebox"S and subsequently the import fails with :API0413: Illegal name [<tablename>] Name with preceding and trailing spaces is not allowed.
The gateway have been configured with the following parameters:
HS_FDS_CONNECT_INFO=<connect string>
HS_FDS_TRACE_LEVEL=OFF
HS_FDS_RECOVERY_ACCOUNT=RECOVER
HS_FDS_RECOVERY_PWD=RECOVER
HS_LANGUAGE=AMERICAN_AMERICA.WE8MSWIN1252
Any ideas ?
This topic has been posted in the Heterogenious Forum as well, but as the problem is within OWB, I also post it here.
Thanks in advance!
Henrik
Edited by: he**** on Nov 15, 2011 1:29 PMHenrik,
I've found other problems where OWB adds a space between all characters returned from SQL*Server which is what is happening in your case, although it is being displayed as a square box.
In one of these cases the problem was fixed by using the 11.2.0.2 OWB so would it be possible for you to try with that version ?
Also, as the problem is not with the gateway itself as you can select successfully using a database link then it would be better to follow up in the OWB forum -
Forum: Warehouse Builder
Warehouse Builder
as they will be able to help with the OWB side of the problem.
Regards,
Mike -
I have a sql server source, and the target is oracle10.2. OWB 10.2. I can connect to connect to sql server from sql*plus and see the data.
In OWB i imported the tables and created a simple mapping 1:1. It Validated and generated code successfully.
When i deploy the mapping first time i am not getting error message but i get 6 warning messages. but when i deploy the mapping second time i am getting following error and 6 warning messages.
Name Action Status Log
NON_ORACLE_SS_LOCATION1 Create Error RA-02011: duplicate database link name
SRT_I_ODBC_M Create Warning ORA-06550: line 11, column 3: PL/SQL: SQL Statement ignored
SRT_I_ODBC_M Create Warning ORA-06550: line 147, column 7: PL/SQL: SQL Statement ignored
SRT_I_ODBC_M Create Warning ORA-06550: line 177, column 3: PL/SQL: ORA-00942: table or view does not exist
SRT_I_ODBC_M Create Warning ORA-06550: line 26, column 3: PL/SQL: ORA-00942: table or view does not exist
SRT_I_ODBC_M Create Warning ORA-06550: line 34, column 3: PL/SQL: SQL Statement ignored
SRT_I_ODBC_M Create Warning ORA-06550: line 49, column 3: PL/SQL: ORA-00942: table or view does not exist
can i know where exactly i am going wrong?Henrik,
I've found other problems where OWB adds a space between all characters returned from SQL*Server which is what is happening in your case, although it is being displayed as a square box.
In one of these cases the problem was fixed by using the 11.2.0.2 OWB so would it be possible for you to try with that version ?
Also, as the problem is not with the gateway itself as you can select successfully using a database link then it would be better to follow up in the OWB forum -
Forum: Warehouse Builder
Warehouse Builder
as they will be able to help with the OWB side of the problem.
Regards,
Mike -
Error in Oracle 10 Procedure - converted from SQL Server
I have converted the folowing script from SQL Server proc to Oracle Proc; it compiles with a warning "30 Hint: Comparision with NULL in 'sp_MyEmployee'"
When this proc is executed; it generates an error "ORA-00900: invalid SQL statement"
Please help!
CREATE OR REPLACE PROCEDURE osp_DMEmployee(v_ahRole IN VARCHAR2 DEFAULT null,
v_Exclusion IN varchar2 DEFAULT null) as
v_MyString varchar2(32767);
v_spot NUMBER(5,0);
v_str varchar2(8000);
v_email varchar2(5000);
SWV_Exclusion varchar2(5000);
BEGIN
SWV_Exclusion := v_Exclusion;
v_MyString := 'SQLWAYS_EVAL# exprsnlid, dmdescription, dmregion, dmfieldloc, dmbusentity,
dmemployeenum, dmusername, dmtitle, dmemail, ahrole
FROM dm_Employee WHERE dmEmail is NOT NULL';
if v_ahRole is not NULL then
IF v_ahRole = 'PLANNER' then
v_MyString := v_MyString || 'SQLWAYS_EVAL# AND (DMTitle like ''%Coord%'' OR DMTitle like ''%Planner%'' OR DMTitle like ''%Svc Leader%'') ';
end if;
IF v_ahRole = 'TECHNICIAN' then
v_MyString := v_MyString || 'SQLWAYS_EVAL# ''' || v_ahRole || 'SQLWAYS_EVAL# is NOT NULL ';
end if;
IF v_ahRole = 'SUPERVISOR' then
v_MyString := v_MyString || 'SQLWAYS_EVAL# ''' || v_ahRole || 'SQLWAYS_EVAL# is NOT NULL ';
end if;
end if;
IF SWV_Exclusion is NOT NULL then
/* WHILE SUBSTR(CAST(SWV_Exclusion AS VARCHAR2),1,4000) <> '' LOOP */
WHILE SWV_Exclusion <> '' LOOP
v_spot := instr(SWV_Exclusion,',');
IF v_spot > 0 then
v_str := SUBSTR(SWV_Exclusion,1,v_spot -1);
SWV_Exclusion := SUBSTR(SWV_Exclusion,-(LENGTH(SWV_Exclusion) -v_spot));
ELSE
v_str := SWV_Exclusion;
SWV_Exclusion := '';
end if;
IF v_email is NOT NULL then
v_email := v_email || ',' || ' ''' || SUBSTR(v_str,1,100) || ''' ';
ELSE
v_email := ' ''' || SUBSTR(v_str,1,100) || ''' ';
end if;
END LOOP;
end if;
v_MyString := v_MyString || 'SQLWAYS_EVAL# IN (' || v_email || ')';
v_MyString := v_MyString || 'SQLWAYS_EVAL# ail';
DBMS_OUTPUT.PUT_LINE(SUBSTR(v_MyString,1,250));
EXECUTE IMMEDIATE v_MyString;
RETURN;
END;1) When discussing an error, please copy the actual error message. Usually you will get a line number to assist investigation;
2) Please refer to the FAQ (upper right corner of page) to show how to preserve code and make your question more readable;
3) Please ask the question in a forum that deals with the topic - such as "Database - General" (look for "Forum Home" link at top left of page)
4) Please note that the title of this forum is "Community Feedback and Suggestions (Do Not Post Product-Related Questions Here)"
(And ... did you display the SQL that you were attempting to execute. Execute Immediate is a last resort style of programming - not nice for most Oracle apps.) -
How to convert from SQL Server table to Flat file (txt file)
I need To ask question how convert from SQL Server table to Flat file txt file
Hi
1. Import/Export wizened
2. Bcp utility
3. SSIS
1.Import/Export Wizard
First and very manual technique is the import wizard. This is great for ad-hoc and just to slam it in tasks.
In SSMS right click the database you want to import into. Scroll to Tasks and select Import Data…
For the data source we want out zips.txt file. Browse for it and select it. You should notice the wizard tries to fill in the blanks for you. One key thing here with this file I picked is there are “ “ qualifiers. So we need to make
sure we add “ into the text qualifier field. The wizard will not do this for you.
Go through the remaining pages to view everything. No further changes should be needed though
Hit next after checking the pages out and select your destination. This in our case will be DBA.dbo.zips.
Following the destination step, go into the edit mappings section to ensure we look good on the types and counts.
Hit next and then finish. Once completed you will see the count of rows transferred and the success or failure rate
Import wizard completed and you have the data!
bcp utility
Method two is bcp with a format file http://msdn.microsoft.com/en-us/library/ms162802.aspx
This is probably going to win for speed on most occasions but is limited to the formatting of the file being imported. For this file it actually works well with a small format file to show the contents and mappings to SQL Server.
To create a format file all we really need is the type and the count of columns for the most basic files. In our case the qualifier makes it a bit difficult but there is a trick to ignoring them. The trick is to basically throw a field into the
format file that will reference it but basically ignore it in the import process.
Given that our format file in this case would appear like this
9.0
9
1 SQLCHAR 0 0 """ 0 dummy1 ""
2 SQLCHAR 0 50 "","" 1 Field1 ""
3 SQLCHAR 0 50 "","" 2 Field2 ""
4 SQLCHAR 0 50 "","" 3 Field3 ""
5 SQLCHAR 0 50 ""," 4 Field4 ""
6 SQLCHAR 0 50 "," 5 Field5 ""
7 SQLCHAR 0 50 "," 6 Field6 ""
8 SQLCHAR 0 50 "," 7 Field7 ""
9 SQLCHAR 0 50 "n" 8 Field8 ""
The bcp call would be as follows
C:Program FilesMicrosoft SQL Server90ToolsBinn>bcp DBA..zips in “C:zips.txt” -f “c:zip_format_file.txt” -S LKFW0133 -T
Given a successful run you should see this in command prompt after executing the statement
Starting copy...
1000 rows sent to SQL Server. Total sent: 1000
1000 rows sent to SQL Server. Total sent: 2000
1000 rows sent to SQL Server. Total sent: 3000
1000 rows sent to SQL Server. Total sent: 4000
1000 rows sent to SQL Server. Total sent: 5000
1000 rows sent to SQL Server. Total sent: 6000
1000 rows sent to SQL Server. Total sent: 7000
1000 rows sent to SQL Server. Total sent: 8000
1000 rows sent to SQL Server. Total sent: 9000
1000 rows sent to SQL Server. Total sent: 10000
1000 rows sent to SQL Server. Total sent: 11000
1000 rows sent to SQL Server. Total sent: 12000
1000 rows sent to SQL Server. Total sent: 13000
1000 rows sent to SQL Server. Total sent: 14000
1000 rows sent to SQL Server. Total sent: 15000
1000 rows sent to SQL Server. Total sent: 16000
1000 rows sent to SQL Server. Total sent: 17000
1000 rows sent to SQL Server. Total sent: 18000
1000 rows sent to SQL Server. Total sent: 19000
1000 rows sent to SQL Server. Total sent: 20000
1000 rows sent to SQL Server. Total sent: 21000
1000 rows sent to SQL Server. Total sent: 22000
1000 rows sent to SQL Server. Total sent: 23000
1000 rows sent to SQL Server. Total sent: 24000
1000 rows sent to SQL Server. Total sent: 25000
1000 rows sent to SQL Server. Total sent: 26000
1000 rows sent to SQL Server. Total sent: 27000
1000 rows sent to SQL Server. Total sent: 28000
1000 rows sent to SQL Server. Total sent: 29000
bcp import completed!
BULK INSERT
Next, we have BULK INSERT given the same format file from bcp
CREATE TABLE zips (
Col1 nvarchar(50),
Col2 nvarchar(50),
Col3 nvarchar(50),
Col4 nvarchar(50),
Col5 nvarchar(50),
Col6 nvarchar(50),
Col7 nvarchar(50),
Col8 nvarchar(50)
GO
INSERT INTO zips
SELECT *
FROM OPENROWSET(BULK 'C:Documents and SettingstkruegerMy Documentsblogcenzuszipcodeszips.txt',
FORMATFILE='C:Documents and SettingstkruegerMy Documentsblogzip_format_file.txt'
) as t1 ;
GO
That was simple enough given the work on the format file that we already did. Bulk insert isn’t as fast as bcp but gives you some freedom from within TSQL and SSMS to add functionality to the import.
SSIS
Next is my favorite playground in SSIS
We can do many methods in SSIS to get data from point A, to point B. I’ll show you data flow task and the SSIS version of BULK INSERT
First create a new integrated services project.
Create a new flat file connection by right clicking the connection managers area. This will be used in both methods
Bulk insert
You can use format file here as well which is beneficial to moving methods around. This essentially is calling the same processes with format file usage. Drag over a bulk insert task and double click it to go into the editor.
Fill in the information starting with connection. This will populate much as the wizard did.
Example of format file usage
Or specify your own details
Execute this and again, we have some data
Data Flow method
Bring over a data flow task and double click it to go into the data flow tab.
Bring over a flat file source and SQL Server destination. Edit the flat file source to use the connection manager “The file” we already created. Connect the two once they are there
Double click the SQL Server Destination task to open the editor. Enter in the connection manager information and select the table to import into.
Go into the mappings and connect the dots per say
Typical issue of type conversions is Unicode to non-unicode.
We fix this with a Data conversion or explicit conversion in the editor. Data conversion tasks are usually the route I take. Drag over a data conversation task and place it between the connection from the flat file source to the SQL Server destination.
New look in the mappings
And after execution…
SqlBulkCopy Method
Sense we’re in the SSIS package we can use that awesome “script task” to show SlqBulkCopy. Not only fast but also handy for those really “unique” file formats we receive so often
Bring over a script task into the control flow
Double click the task and go to the script page. Click the Design script to open up the code behind
Ref.
Ahsan Kabir Please remember to click Mark as Answer and Vote as Helpful on posts that help you. This can be beneficial to other community members reading the thread. http://www.aktechforum.blogspot.com/ -
Convert BW from Sql Server to Oracle
Does anyone know of any documents that discuss converting an existing BW implementation from Sql Server to Oracle?
Never heard about ... we did something similar but creating a "new" BW sys by Change Requests, and the populating it with data.
Hope it helps
GFV -
Can I preserve carriage returns in a string variable from SQL Server?
I have an OLE data source that pulls data from sql server via a SELECT query. One of the fields is an NVARCHAR(max) which goes into a string variable which is later used in an expression. I am noticing that in the expression, carriage returns
/ line breaks in this field are being lost. Does anyone know how I can preserve these in the expression?Thanks everyone for the suggestions. I am certain there are both \r and \n in the database as when I print the field and then copy/paste to textedit to show the hidden characters, I can see both the CR and LF's.
I have implemented a workaround that is by no means elegant, but it gets the job done.
I found that \r and \n will evaluate in an expression but if they are part of another string variable, SSIS escapes them. My workaround was to change my OLE_DB select statement (which fetches the custom SQL query) to explicitly change the hidden characters
to '\r' and '\n' respectively:
SELECT REPLACE(REPLACE([CUSTOM_SQL],char(13),'\r'),char(10),'\n')
Then, in my SSIS expression, I de-escaped these characters:
REPLACE(REPLACE(@[User::vAlertCustomSQL],"\\r","\r"),"\\n","\n")
Now when the expression is executed, the SQL is formatted correctly and oddly placed comments in the query no longer break the query. -
How to delete the Folder from sql server 2008
Hi all,
I was trying to delete the folder from sql server 2008 with the below script
DECLARE @path VARCHAR(256) -- path for backup files
DECLARE @cmd VARCHAR(8000)
DECLARE @folderName VARCHAR(256) -- filename for backup
SET @folderName = + (CONVERT(varchar(10), GETDATE()-7, 112)) -- 7 days back date folder name
SET @path = 'I:\Backup_Test\' + @folderName -- Folder path
SET @cmd = 'del ' + @path -- Delete
EXEC master..xp_cmdshell @cmd
--Print @cmd
This is not working it was asking the Confirmation (I:\Backup_Test\20100629\*, Are you sure (Y/N)? ) what will i do to the delete the folder.
Thanks,
Prasad R.I would notice you that T-SQL does not play well to do things like that. Do not you want using .net language to delete folders?
Old method is
declare @HR int, @CFOLDER varchar(255),@FSO int
set @CFOLDER='D:\folder\'
EXEC @HR = sp_OACreate 'Scripting.FileSystemObject', @FSO OUT
EXEC @HR = sp_OAMethod @FSO, null, 'DeleteFolder', @CFOLDER
Now regarding to your second question please examine xp_fileexist system stored procedure
CREATE FUNCTION dbo.fn_file_exists(@filename VARCHAR(300))
RETURNS INT
AS
BEGIN
DECLARE @file_exists AS INT
EXEC master..xp_fileexist @filename, @file_exists OUTPUT
RETURN @file_exists
END
GO
-- test
SELECT dbo.fn_file_exists('c:\a.txt')
Best Regards, Uri Dimant SQL Server MVP http://dimantdatabasesolutions.blogspot.com/ http://sqlblog.com/blogs/uri_dimant/ -
I have a problem where I have an SSIS package (SQL Server 2005) that won't run properly from SQL Server Agent, but it runs fine when kicked off manually from Integration Services -> Run Package or when run in debug from Visual Studio.
The first step in the package checks for the existance of a file via a script task. The script looks like this...
Code Block
Public Sub Main()
Dim TaskResult As Integer
Dim ImportFile As String = CStr(Dts.Variables("BaseDirectory").Value) + CStr(Dts.Variables("ImportDirectory").Value) + CStr(Dts.Variables("ImportFile").Value)
If Dir(ImportFile) = "" Then
Dts.TaskResult = Dts.Results.Failure
Else
Dts.TaskResult = Dts.Results.Success
End If
Return
End Sub
This script runs fine and the file is seen as expected when I run the package manually. But as a step in a SQL Server Agent job, it doesn't see the file.
The SQL Server Agent service is set to start up / log on as a Local System Account. I've also tried setting up a credential / proxy (using an account that I know can see and even move / rename the file) to run the job as but that didn't seem to help.
The package is being run from SQL Server (stored in MSDB) and is set to rely on SQL Server for sensitive information, so I don't think that's an issue; other packages are set up like this in terms of sensitive data and run fine.
Any ideas why my script can't "see" the file I'm looking at when it's kicked off by SQL Server agent? I've looked and looked...I can't seem to figure this out. I would really appreciate any help you might be able to offer up.If the variables are fine, then I think it is very likely that this is security related. Since the Agent is running under the local system account, have you verified that the local account can access the file? When you tried the proxy account, are you positive that it was set up properly, and that the account had the permissions to read the file?
Another thing to check - is this a local file or is on another computer? If it is on another computer, make sure you are using a UNC path and not a mapped drive. -
I'm looking for some general guidance on this complete error:
Msg 0, Sev 0, State 1: Unknown token received from SQL Server [SQLSTATE HY000]
String data, right truncation [SQLSTATE 01004]
Msg 16389, Sev 16, State 1: The connection is no longer usable because the server response for a previously executed statement was incorrectly formatted. [SQLSTATE 08S01]
This error is caused by a SQL Agent Job, but it does not always occur. I understand this could be an issue with SQL dropping the connection, but what is the best way to troubleshoot this?
Thanks,
PhilHi philliptackett77,
It would be more helpful for troubleshooting the issue if you post the SQL Server error log and SQL Server version. Additionally, please state what purpose of using the agent job.
Based on my research, [SQLSTATE 08S01] error means communication link failure. If the executed statement returns invalid value in the job, the connection between server and client will fail. This error could be caused by the error of [SQLSTATE HY000] and
[SQLSTATE 01004]. I’d like to share my knowledge about these errors as below.
Quote: String data, right truncation [SQLSTATE 01004]
This error could occur when passing data whose length is larger than the received object,and the passed value is truncated, and returns invalid value. So please check if the data type of the objects are identical and the length of passed value is not larger
than the received object.
Quote: Msg 0, Sev 0, State 1: Unknown token received from SQL Server [SQLSTATE HY000]
The error could occur in the two cases below.
1. If you use SQL Server version 6.50, and execute the cursor in the job step, set the statement options to use a server-side cursor and prepare a select statement on a SQL Server system table. The first execution of the select creates the cursor successfully.
After you close this cursor, if you execute the prepared statement again, the error could occur.
I recommend you to apply the latest service pack firstly. If the error still occurs, you could change your code by using a forward-only cursor instead of a static, keyset, or dynamic cursor on the system tables. If a forward-only cursor is unacceptable,
prepare the select statement again on the system table and execute it to create a server-side cursor. For more information about the process, please refer to the article:
http://support.microsoft.com/kb/151693/en-us
2. The TDS stream from the server is invalid when transfer data between a database server and a client. This error is typically caused by a problem on the server. For more information about errors above, please refer to the article:
http://technet.microsoft.com/en-us/library/aa937531(v=sql.80).aspx
Regards,
Michelle Li -
Select from SQL Server Activity
Hi,
I'm using the Select from SQL Server Activity in CPO to look up some values in a table, straightforward SQL queries like select * from Table work 100% but when I start applying a WHERE clause to the query it fails to return the results even though when running query in SQL studio it returns results successfully.
The issue seems to be when trying to use brackets in a OR statement:
The SQL Statement is:
SELECT AppName FROM METADaaS WHERE
NCCX NOT LIKE '%18421%'
AND RTYPE='A'
AND BUNDLEDWITH LIKE '%GOL Back Office%'
AND (NCC = '0' OR NCC LIKE '%18421%')
This returns no results in CPO but in SQL Studio returns the results as expected.
If I remove the "(NCC = '0' OR NCC LIKE '%18421%')" I get results in CPO.
thanksAny SQL statement should work. I would suggest you open a TAC case.
-
Importing from SQL Server - Performance
Hello,
I am developing an Access 2010 database with a SQL Server 2008 R2 backend. I would be interested in getting some feedback on which method of retrieving the results from SQL Server and displaying them in Excel would show the best performance. Assume the following
options.
1. Create a pass-through query in Access and execute the following VBA code;
Set qdf = db.QueryDefs("qry_Passthrough")
SQL = "SELECT * FROM qry_Passthrough WHERE ID = 1"
Set rst = qdf.OpenRecordset(SQL, dbOpenSnapshot)
2. Create a pass-through query in VBA code;
Set qdf = db.CreateQueryDef("")
qdf.SQL = "SELECT * FROM tbl_Data WHERE ID = 1"
Set rst = qdf.OpenRecordset(dbOpenSnapshot)
3. Create an inline table valued function (itvf_Data) and pass in the ID parameter;
Set qdf = db.CreateQueryDef("")
qdf.SQL = "SELECT * FROM dbo.itvf_Data (1)"
Set rst = qdf.OpenRecordset(dbOpenSnapshot)
4. Create a View in SQL Server and return the results;
Set qdf = db.CreateQueryDef("")
qdf.SQL = "SELECT * FROM vw_Data WHERE ID = 1"
Set rst = qdf.OpenRecordset(dbOpenSnapshot)
5. Create a linked View in Access to reference vw_Data;
SQL = "SELECT * FROM dbo_vw_Data WHERE ID = 1"
Set rst = qdf.OpenRecordset(SQL, dbOpenSnapshot)1.,2.: As long as it's a passthrough the creation of it does not influence the performance.
3.: A TVF is a good development tool. As long as you call it only with parameters, it's imho okay. The problems begin when you need additional condtions. Adding them as WHERE clause may affect performance, cause SQL Server cannot optimize them well.
4./5. Server-side views are clearly the best approach. Due to o9ptimization and plan caching by SQL Server. -
Hi All,
I am getting error "Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The status code returned from the server was: 500"
in one of my Test Environment when trying to run the SSRS 2012 report from report manager.
Any clue why it is happening.
Thanks Shiven:) If Answer is Helpful, Please VoteHi All,
Upon investigation found that there was no space (0 Byte is available) in E drive where underlying SQL DB is residing.
Once I cleared the space, report started working and above error was not displaying.
Thanks Shiven:) If Answer is Helpful, Please Vote
Maybe you are looking for
-
Any suggestions for my code.
Hi, I wrote this little piece of code to reduce some of the work I need to do when doing database access. I intend to use if with mySQL and mostly web based applications. It'll probably use it quite a bit, and since it's my first try at writing somet
-
My Apple TV no longer plays anything from my mac. It does continue to play Netflix.
My Apple TV will not play any intent from my iTunes account. How can I fix this?
-
I'v got an N70. I'v moves my messages to phone memory from my mmc card by moving the Mail folder from E:/System to C:/System they are moved and can be seen in my phone messasges but they cannot be opened now ! What to do now?
-
Osx 10.5.8 to 10.6.4
I have been thinking about upgrading to osx 10.6.4 as my girlfriend just got a brand new macbook with it. I have had mine since 2008 running osx 10.5.8 and never had any problems and runs really smoothly. I however feel I don"t use my machine to if f
-
How to Find the Explicitly Created Schemas in the Database?
Hi, I am Using Oracle 11g Database R1 on Windows 2003 Server R2 , My Doubt is How Can i find the list of Schemas are explicitly created in the Database , We can Query this Tables DBA_USER Or SYS.USER$ to find the List of Available Schemas ( But it sh