No connection to tables, sprocs etc [closed] - sql

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have been working on a database for a couple of weeks now, and suddenly nothing works and I just can't figure out how to solve it.
I can login to SQL server and list all the tables and sprocs. The problem is that when I try to run a sproc I get a message telling me that there are no such table, even though it exists.
When I try to alter or create a sproc I get the following message:
Msg 262, Level 14, State 1, Procedure usp_GetUser, Line 14
CREATE PROCEDURE permission denied in database 'master'.
What can be wrong?

... in database 'master'.
Wrong database context: I assume it should be "MyDatabase" not "master"

You're currently running against the master database rather than whichever user database you have been working on.
Either run
use MyDatabaseName
Or at the top of SSMS there is a drop down that currently says ''master". Change it to your database name

Related

Synapse Serverless Stored Procedure is not executed in Synapse Pipelines [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 days ago.
The community is reviewing whether to reopen this question as of 3 days ago.
Improve this question
I have a stored procedure stored in a Serverless Pool SQL DB
(https://i.stack.imgur.com/wSppv.png)
In Synapse Pipelines I' no able to use the SQL Pool Stored Procedure activity because is only for a Dedicated Pool so I'm using the Stored Procedure Activity
(https://i.stack.imgur.com/zlBLJ.png)
When triggered the corresponding pipeline nothing happens
(https://i.stack.imgur.com/rmHLR.png)
I was investigating any restriction on using the Stored Procedure Activity and nothing. I do not want to use the Script Activity but if there's no other chance I'll be forced to do that.
A sample of the script is
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE OR ALTER PROCEDURE CSVtoParquetBronze
AS
IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[bronze].[Table]') AND type in (N'U'))
DROP EXTERNAL TABLE bronze.Table;
GO
CREATE EXTERNAL TABLE bronze.Account
WITH
(
LOCATION = 'bronze/Table',
DATA_SOURCE = lakehouse_EDS,
FILE_FORMAT = SynapseParquetFormat
)
AS
SELECT *
FROM dbo.Table
GO
GO
The expecting result its simple since the connection is working fine and the Stored Procedure exists in the Database as well as the location, data source y file format.
(https://i.stack.imgur.com/5d1f4.png)

SQL Server -Succeed insert statement but records did not load [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
On what scenario can merge/insert/update statement complete successfully without error and not load any records to the target table because of some error, locking or other issue?
I am trying to see what scenario my stored procedure will not fail or throw errors but records would not be loaded in database.
On what scenario can merge/insert/update statement complete successfully without error and not load any records to the target table
Some possibilities:
the DML statement succeeded, but affected 0 rows
it succeeded, but was in a transaction that was subsequently rolled back
you have INSTEAD OF triggers on the table.
This is assuming you're not looking at the wrong table or the wrong database, which is sometimes easy to do.

how to fix sql server page level corruption? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 5 years ago.
Improve this question
How can i fix the page level corruption in sql database. I am facing a big issue related to this. Can anyone help me.
Go to SQL Server Management Studio
Select the DB
Right Click the DB
Go to Properties
Select Options
Under Other Option select the Page Verify
Select as NONE.
Run this Query to Change DB into Single User Mode
ALTER DATABASE corrupted_db SET SINGLE_USER WITH ROLLBACK IMMEDIATE
Run this Query to Recover the Table/DB.
DBCC CheckTable ('corrupted_table', REPAIR_ALLOW_DATA_LOSS)
(OR)
DBCC CheckDB ('corrupted_db', REPAIR_ALLOW_DATA_LOSS)
Once this Execution Completed Sql returns “Errors are Corrected”
Run this Query to Change the DB into Multi-User Mode
ALTER DATABASE Application Manager SET MULTI_USER
Go to SQL Server Management Studio
Select the DB
Right Click the DB
Go to Properties
Select Options
Under Other Option select the Page Verify
Select the Option CHECKSUM.
Now Run DBCC CHECKDB('Your DB')

how to rollback a transaction using rollback command? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I have deleted a record from my table and after executing rollback command it shows "command completed successfully" but when i check it using select statement the table is still looking empty? why ?
Some database connection methods such as ODBC default to what's known as "autocommit" mode - that is, the database connection automatically issues a COMMIT after each statement is executed. JDBC does the same thing. I cannot say if this is what's happening in your case, but if so there's no way to do a ROLLBACK. Best of luck.
Rollback command takes you back to the latest committed state of the table.I guess your delete query might have contained some statement that committed the change(deletion of record).
Jason Clark,
I did a test using MySql and use the "begin", "delete" and "rollback", used the following SQL (an example):
begin; delete from aluno where id = 1; rollback;
In PostgreSQL, SQL syntax is the same and also worked.
Are you sure you used the correct SQL? I might have been some mistake? Is it really necessary to use "begin transaction" instead of just "begin"?
I hope this helps!

Recommended SP/method to gain information [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 9 years ago.
Improve this question
When I need more information about table and its column I always use the build-in stored procedure 'sp_help xxxxx' to retrieve more information.
What other method or SP are usable to use?
You can use sp_depends to get want tables and columns it is using
EXEC sp_depends yourProcedure;
I prefer to use dynamic management views (DMV) and functions (DMF) to get more information about database server..........The DMV/DMF's have been organized into the following different groups:
Common Language Runtime related
Database Mirroring related
Execution related
Full-Text Search related
Index related
I/O related
Query Notifications related
Replication related
Service Broker related
SQL Server Operation system
Transaction related
Just browsing to the table in SQL Server Management Studio will tell you quite a lot.
Table/Column definitions.
Indexes
Triggers
Constraints
Primary/Foreign Keys
Dependancies
etc, etc
Look into the sysobjects view (http://msdn.microsoft.com/en-us/library/ms177596.aspx):
SELECT * FROM sysobjects WHERE type = 'P'
Other sys view can be handy too.
How about using sp_columns
EXEC sp_columns #table_name = N'TableName'
Using sp_helptext will come in handy, it gives you the definition of a stored procedure, function or view.
I.E.:
CREATE PROC usp_MyProcedure AS SELECT * FROM TABLE
Runing the following will output the query above.
Exec sp_helptext 'usp_MyProcedure'