application is not using the correct connection string - vb.net

In app config file. I used initial catalog ='jana' as database name.
Then i run it use it for some times.
Then later i changed initial catalog ='siva' as database name . That i changed database name alone and saved it. Whenever i run this 'siva' as initial catalog , select queries is using 'siva' database at the same time inserting /updating queries using my previous database 'jana'. Its really weird.

thanks for considering my query. I rectified mistake by myself.
Actually while inserting/updating queries , i have used databasename.dbo.tablename for all queries. That is the cause whenever i used different database , the one which i used on creating was always affected.
Hope u understand my scenario.
Thanks for all.

Related

Is there a way to update a calculation view through a query on SAP HANA?

I'm working on updating hundreds of calculation views on SAP HANA.
I should update (for every calculation view) the last aggregation/projection columns : Keep flag = True.
There's a way, by updating XML Code of every calculation view file Like below:
<attribute id="EQUNR" order="3" attributeHierarchyActive="false"
displayAttribute="false" keepFlag="true">
<descriptions defaultDescription="EQUNR"/>
But, my question is, is there a way to update this Keep Flag through a query on SQL Console ?
if not, is there any other method you suggest guys ?
Every idea matters, Thank you folks
There is no way to achieve this via SQL.
Although you may be able to author a regex expression that matches some of the target XML tags, there’s no way of correctly updating the repository tables storing the source XML (if you’re using the HANA classic repository).
For HANA 2 HDI files no DB command can change the source code as these are not stored in the database.
Beyond this technical issue, it’s probably not a good idea to apply a flag that changes query semantics as a batch update.

Add Use Command when Selecting Top 1000 from Database Object

I've been searching for this answer and haven't had any luck. My problem is that whenever I
Select top 1000 from tblX it defaults the database to Master and I have to manually change to the correct DB. I know on my VDM at work when doing this, it adds a Use command which specifies the correct database and gives me a connection instantly. I've read that you can change the default database, but I will be switching back and forth between many databases. So I want my connection defaulted to which ever database the selected table is from.
You can use [db name].dbo.[table name]
You could always change the default schema for you user. But this is not my preffered approach. You should always use two part name naming or in your case 3 part according to the 70-461 Training kit.

How to get the query displayed when a change is made to a table or a field in a table in Postgresql?

I have used mysql for some projects and recently I moved to postgresql. In mysql when I alter a table or a field the corresponding query will be displayed in the page. But such a feature was not found in postgresql(kindly excuse me if I'm wrong). Since the query was readily available it was very helpful for me to test something in the local database(without explicitly typing the query), copy the printed query and run it in the server. Now it seems like I've to manually do all the trick. Even though I'm familiar with the query operations,at times it can be pretty time consuming process. Can anybody help me? How can I get the corresponding query to get displayed in postgresql(like in mysql) whenever a change is made to the table?
If you use SELECT * FROM ... there should not be any reason for your output to not include newly added columns, no matter how you get your results - would that be psql in command line, PgAdmin3 or any other IDE.
After you add new columns, it is possible that these changes are still in open transaction in other window or SQL command - be sure to COMMIT such transaction. Note that your changes to data or schema will not be visible to any other database clients until transaction commits.
If your IDE still does not show changes, maybe you need to refresh list of tables or if that option is not available, restart your IDE. If that does not work still, maybe you should use better IDE.
If you have used SELECT field1, field2, ... FROM ... then you must add new fields into your SELECT statement(s) - but this would be true for any other SQL implementation, MySQL included.
You could use the LISTEN / NOTIFY mechanism in PostgreSQL to notify your client on altering the database schema.

Is it safe to change name column in msdb sysjobs?

I need to rename a lot of similar named job names so i want to run an update statement to change the name column of msdb..sysjobs.
Editing system tables is something i am pretty aware of, but changing job names doesn't feel that dangerous, because i think the job_id is what counts. Is it safe to do it in this case?
I am using sql server 2008.
When you have the same jobs running in multiple environments, it's a better practice to refer to jobs by name rather than by ID, because a job with the same name will be created with a different ID in every environment.
If you change the name of the jobs, make sure that any scripts you use to manipulate those jobs also use the new name.
I think there is nothing to worry about, you can modify it.
Please find detail about sysjobs here.
It is NOT save to just rename it. Using sql profiler shows, that renaming a package using the object exlorer will start several procedures. It will create a new package using sp_add_dtspackage and drop it later using sp_drop_dtspackage. The package id is although set using a parameter, so setting it random really seems to be a potential risk.

Problem with a MS Access query after a "Compact and repair" operation

I have an Access application that use the classical front-end/back-end approach. Yesterday, the backend got corrupted for a reason I don't know. So I opened the backend with Access 2003 and access asked me if I wanted to repair the file, I said yes and it seemed to work.
I can open the database see the tables contents and run most of the queries.
However there is an access query that doesn't work with a specific where clause.
Example :
// This works in the original DB, but not in the compacted one :
SELECT a, b, c
FROM tbl1 INNER JOIN tbl2 ON tbl1.d = tbl2.d
WHERE e = 3 AND tbl2.f = 1;
// This works in both the original and the compacted one :
SELECT a, b, c
FROM tbl1 INNER JOIN tbl2 ON tbl1.d = tbl2.d
WHERE e = 3;
When I try to run the queries, nothing happens. The access process start to use most of the CPU and the GUI stop responding. If I run the query from the query editor, I can use Ctrl+Break to stop the execution. I tried to give the query lot of time and it didn't help.
I've checked the execution plan in showplan.out and it seems correct (at least it should not takes forever to execute)
I tried to compact the DB again. I tried to import the tables in a new DB. I even tried to import the tables and their data in a mdb file that was in a now good state (from a backup).
Anyone have an idea?
Sounds like an index was corrupted and when that happens, it's dropped during the compact. Check for a system table called MSysCompactErrors -- you'll have to show hidden objects and/or system objects in Tools | Options | VIEW.
Never compact a Jet MDB without making a backup beforehand. Because of that rule, the COMPACT ON CLOSE function is completely useless, as it's not cancellable, so you always make sure it's turned off in all MDBs.
I don't know what type of meta data Access brings along when it imports a table from one database into another one. If the meta data is corrupted, importing the table to another database wouldn't necessarily resolve the problem. If practical, you might try creating the tables from scratch in a brand new database and then just exporting and importing (or copying and paste appending) the data into the new database.
I've never seen a table get corrupted like this in such a small database, although with Access anything is possible. Could there be something wrong with the data?
I'd try recreating the query fresh (new name, etc.), and see what happens.
You could even try copying it (even within the same DB or to a brand new one). If that works, the worst case scenario is you have to copy all the objects across to a new DB.
Is there an index on the field tbl2.f?
Also try going into that table in datasheet view, sort tbl2.f in ascending sequence and see if there is anything really strange in the first or last records.
Do you have access to a SQL Server installation? You could use the Upsizing Wizard under the Tools -> Database Utilities menu to copy the data to SQL Server, and see if you get the same problem there.