How to use sp_depends for other database [closed] - sql

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
Using SQL Server 2010
For updating the tables i am using following line
update database1_ab..table1
For sp_depends i am getting error as "Incorrect syntax near '.'"
sp_depends database1_ab..table1
How to use sp_depends for referring other database tables in current database

regardless, you need to put it in single quotes... ie
sp_depends 'database1_ab..table1'
or
sp_depends '[database1_ab]..[table1]'

You can call all the sp_ -procedures also in different database like this:
database1_ab..sp_depends table1

Related

SQL Insert Query With Condition Exception [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 12 months ago.
Improve this question
I have this query:
String requete = "INSERT INTO reduction(newPrix) VALUES (?) "
+ "WHERE id_prom=? AND id_prod=?";
I am getting an exception:
You have an error in your SQL syntax; check the manual that
corresponds to your MariaDB server version for the right syntax to use
near 'WHERE id_prom=2 AND id_prod=6' at line 1
I'm wondering why the INSERT query was failing. Any advise appreciated.
You insert a row into your table.
This means that you need to specify all mandatory values (i.e. values for the columns that are not nullable and don't have a default value).
You can't use a where clause in this kind of insert statement. What would it mean? And in your program you can verify the validity of the data you'd like to add to your table and decide to insert or not.

How can I get the table name in a SQL Server trigger function? [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 1 year ago.
Improve this question
I tried to get the table name in a SQL Server trigger function but I can't.
Please help me.
Try this query for get the table name using trigger function:
#tablename = OBJECT_NAME(parent_object_id)
FROM sys.objects
WHERE sys.objects.name = OBJECT_NAME(##PROCID)**

Syntax error (missing operator) in query expression ‘[Type]=5 And Left([Name],1)<>"~" OORDER BY [Name]’ [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 3 years ago.
Improve this question
I have to create a list box control that contains all of the queries except for the system queries. Recall that system query names begin with the ~ character.
When I try to write SQL code in the row source (in the property sheet) for my frmQueries form I keep getting an error saying:
Syntax error (missing operator) in query expression:'[Type]=5 And Left([Name],1)<>"~" OORDER BY [Name]'
The code I entered is:
SELECT [Name] FROM MYSysObjects
WHERE [Type]=5 And Left([Name],1)<>"~"
OORDER BY [Name];
I am not sure why I am getting this error or how I can fix it.
OORDER should be ORDER, MYSysObjects should (presumably) be MSysObjects, and you can also replace Left([Name],1)<>"~" with [Name] not like "~*" (assuming MS Access instead of SQL Server).

Alter script not working on server [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 8 years ago.
Improve this question
I have an alter script to change datatype from nvarchar to float which works fine in my local machine but fails to work on 2012 server.
Can anybody tell me what's wrong with my script or any changes need to be done on server?
My alter script is as follows:
ALTER TABLE mytable
ALTER COLUMN mycolumn FLOAT
and I get this error:
Msg 8114, level 16,state 5, line 6
Error converting datatype nvarchar to float
If it is throwing an error 'Error converting data type varchar to float.' then it is obvious that there are some values in the varchar field which cannot be converted to float. If you can tell us more about the error being thrown, it will be easier to understand the issue.

Error message from simple SELECT statement with practice database [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 8 years ago.
Improve this question
I use the AdventureWorks practice database attached to SQL Server 2012.
A simple statement like:
SELECT * FROM HumanResources.Shift;
gives me this error:
Msg 208, Level 16, State 1, Line 1
Invalid object name 'AdventureWorks2012'.
I also tried:
USE master
GO
SELECT * FROM HumanResources.Shift;
Received same error message. Any idea to why this is happening?
Is AdventureWorks2012 the name of a database or a table?
USE <database name>
means use the specified database to run the query against.
SELECT * FROM <table name>
means select all the rows from the specified table.
--Edit because of change in question--
You don't want to use Master, you want to use the name of your DB. Next, using the object explorer, I would make sure the table actually exists in the Database you created.