Intellij idea - choose schema warning, how to get rid of it? - intellij-idea

I've added datasource to the page ( that has users table ) and then this happened.
It is not a compilation error, just a warning from idea, but what can I do to get rid of it?
When I click 'Choose schema' nothing happens.

Set your project SQL Dialect: Settings -> Languages & Frameworks -> SQL Dialects
SQL Dialects
Set your SQL Resolution Scope to point to your schema: Settings -> Languages & Frameworks -> SQL Resolution Scopes
SQL Resolution Scope
You might have to manually add the path of your project and schema if the dropdown is not populated

Related

Error message when using UDF and javascript - The project ____ has not enabled BigQuery

In BigQuery console I created a UDF function (language js) and now trying to call it from a saved query. I tried referencing the UDF with projectID.dataset.UDF_Name (same as I am using the for referencing vies/tables). When I click Run in UI I got an error:
"The project XXX has not enabled BigQuery"
I checked the BigQuery API and it says enabled.
When I only used dataset.UDF_Name for reference the query worked but I can save it as view getting another error: Bad routine reference "dataset.UDF_Name()"; routine references in standard SQL views require explicit project IDs
So clearly, the right approach is to use the projectID.dataset.UDF_Name() format but I can't figure out how to get rid of the "The project XXX has not enabled BigQuery" error.
Any help, much appreciated.

How do you see what SQL IronSpeed sends to the database?

I'm using IronSpeed Designer 12.2 and trying to write custom SQL in a WhereClause override. The custom SQL I wrote and submitted in the WhereClause is throwing an SQL exception, but I can't see the SQL IronSpeed is sending to the database. Without the SQL, I cannot troubleshoot.
I can't find where the SQL is submitted to the database, such as by an ExecuteReader method call.
I'm using a statement like this:
if (MiscUtils.IsValueSelected(this.MyFilter)) {
String sql = "(EXISTS (SELECT TOP 1 CompanyId FROM Collateral as c WHERE CODE = '{0}' AND c.CompanyId = Company.CompanyId))";
wc.iAND(String.Format(sql, this.MyFilter.SelectedValue));
}
I know my WhereClause SQL is correct when used outside of IronSpeed because I copy-pasted it from a query working directly in MSSQL. However I can't see how IronSpeed combines it with its internally-generated SQL after it becomes a WhereClause.
I'm hoping someone has experience with this issue and can point me in the right direction. Thanks for the help!
If you look for answer long enough, you can find it yourself. Here's how I found you can examine the SQL sent to the database:
Go to C:\Program Files\Iron Speed\Designer v12.2.0.
Copy the BaseClasses folder to the root of my IronSpeed solution folder.
Add the existing BaseClasses project to the IronSpeed solution.
Delete the existing references to baseclasses.dll from the projects in the IronSpeed solution (I'm using a web app rather than web site project).
Add references to the BaseClasses project now included in the solution.
Open the file MicrosoftDynamicSQLAdapter.vb.
In method GetRecordValuesEx(...), go to line 1514 statement "reader = SqlTransaction.ExecuteReader(myCommand, cmdBehavior)" and set a breakpoint on this line.
Run the project. When the breakpoint is hit, examine the command of myCommand object.

unresolved reference to object [INFORMATION_SCHEMA].[TABLES]

I've created a UDF that accesses the [INFORMATION_SCHEMA].[TABLES] view:
CREATE FUNCTION [dbo].[CountTables]
(
#name sysname
)
RETURNS INT
AS
BEGIN
RETURN
(
SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = #name
);
END
Within Visual Studio, the schema and name for the view are both marked with a warning:
SQL71502: Function: [dbo].[CountTables] has an unresolved reference to object [INFORMATION_SCHEMA].[TABLES].
I can still publish the database project without any problems, and the UDF does seem to run correctly. IntelliSense populates the name of the view for me, so it doesn't seem to have a problem with it.
I also tried changing the implementation to use sys.objects instead of this view, but I was given the same warning for this view as well.
How can I resolve this warning?
Add a database reference to master:
Under the project, right-click References.
Select Add database reference....
Select System database.
Ensure master is selected.
Press OK.
Note that it might take a while for VS to update.
In our project, we already have a reference to master, but we had this issue. Here was the error we got:
SQL71502: Procedure: [Schema].[StoredProc1] has an unresolved reference to object [Schema].[Table1].[Property1].
To resolve the reference error, on the table sql file,
right click properties and verify the BuildSettings are set to Build.
Changing it build fixed it.
what Sam said is the best way for doing this.
However, if you have a scenario that you need to deploy the dacpac from a machine that doesn't have that reference in that specific location, you may get into trouble.
Another way is to open your .project file and make sure the following tag has the value of false for the build configuration you are trying to run.
<TreatTSqlWarningsAsErrors>false</TreatTSqlWarningsAsErrors>
This way you don't need to add a reference to your project.
I'm using VS 2019, And even after adding the master db reference still got this issue. Resolved this by Changing the target platform of the DB project as shown in the image below. I had to remove and add back the master db again after this change.

Sql Directives error in visual cobol

i am currently creating my project in cobol2 .. i am using a visual cobol of microfocus and was used a Ado.net for my database.. On the interface of openesql assistant i can insert values in my database table..
but on the form of my project on the button1 clicked i've got an error saying "NO SQL DIRECTIVES HAVE BEEN SET"
(here is my code
method-id button1_Click final private.
procedure division using by value sender as object e as type System.EventArgs.
EXEC SQL
INSERT INTO NayreInventory
(ItemCode
,ItemDescription
,Quantity
,Price
) VALUES (
:NayreInventory-ItemCode:NayreInventory-ItemCode-0001
,:NayreInventory-ItemDescription:Col-2-MEDICOL
,:NayreInventory-Quantity:NayreInventory-Quantity-5
,:NayreInventory-Price:NayreInventory-Price-150
)
END-EXEC.
invoke type MessageBox::Show("1 RECORD HAS BEEN SUCCESSFULLY ADDED", "RESULT")
end method.
)
how to get rid on the error..
please help me .. i really nid ur help..
Do you have a message number as well, like this?
"0149 No SQL directives have been set"
The description of that message is:
"An EXEC SQL statement has been encountered but no SQL directive has been specified. The processing of the statement varies depending on whether the directive SQL is set or not; either SQL or NOSQL must be explicitly specified.
See Also:
The SQL Compiler directive in the chapter Directives for Compiler in your Server Express User's Guide."
So it would look like you are missing a "compiler option" from your compile script.
This is from: http://supportline.microfocus.com/documentation/books/sx20books/emsynt.htm
To get the information I just googled your error message.
There are several ways to specify Micro Focus COBOL compiler directives. One way to specify your SQL/NOSQL directive is to embed the directive in your COBOL source, with the $ in column 7, like so:
$SET SQL
or, depending on your needs:
$SET NOSQL
You can also use the command line:
cob -C SQL ...source file name and other arguments
Follow the links for more details.

DB Query no longer recognizes SQL parameters in existing application when debugging in VS2010

I just started working with an application that I inherited from someone else and I'm having some issues. The application is written in C# and runs in VS2010 against the 3.5 framework. I can't run the application on my machine to debug because it will not recognize the way they referenced their parameters when writing their DB queries.
For instance wherever they have a SQL or DB2 query it is written like this:
using (SqlCommand command = new SqlCommand(
"SELECT Field1 FROM Table1 WHERE FieldID=#FieldID", SQLconnection))
{
command.Parameters.AddWithValue("FieldID", 10000);
SqlDataReader reader = command.ExecuteReader();
...
If you will notice the "parameters.AddWithValue("FieldID", 10000);" statement does not include the "#" symbol from the original command text. When I run it on my machine I get an error message stating that the parameter "FieldID" could not be found.
I change this line:
command.Parameters.AddWithValue("FieldID", 10000);
To this:
command.Parameters.AddWithValue("#FieldID", 10000);
And all is well... until it hits the next SQL call and bombs out with the same error. Obviously this must be a setting within visual studio, but I can't find anything about it on the internet. Half the examples for SQL parameter addition are written including the "#" and the other half do not include it. Most likely I just don't know what to search for.
Last choice is to change every query over to use the "#" at the front of the parameter name, but this is the transportation and operations application used to manage the corporation's shipments and literally has thousands of parameters. Hard to explain the ROI on your project when the answer to the director's question "How's progress?" happens to be "I've been hard at it for a week and I've almost started."
Has anyone run into this problem, or do you know how to turn this setting off so it can resolve the parameter names without the "#"?
Success! System.Data is automatically imported whenever you create a .NET solution. I removed this reference and added it back to make sure that I had the latest version of this library and that fixed the issue. I must have had an old version of this library that was originally pulled in... only thing I can figure.
Its handled by the .NET Framework data providers not Visual Studio.
It depends on the data source. Look here:Working with Parameter Placeholders
You can try working with System.Data.Odbc provider and using the question mark (?) place holder. In thios case dont forget to add the parameters in the same order they are in the query.