I have a schema named "Core" and this schema has several domains (Id, Name, ...)
My DBMS is Microsoft SQL Server 2014.
This is the definition for "Name" domain:
When I generate Sql the column tables haven't the domain schema:
If I run the sql as PowerDesigner generates, I get an error telling me that not found "Id": Msg 2715, Level 16, State 6, Line 18 Column, parameter, or variable #1: Cannot find data type Id
When I manually write the schema before domain its works. This way:
create table Security.Table1 (
Id Core.Id not null,
Nombre Core.Name not null
)
How to do to force generate sql with domains schema name?
Related
I'm Tried input INSERT INTO with other table, but I've error log:
Mensagem 40515, NĂvel 15, Estado 1, Linha 18
Reference to database and/or server name in 'deletadosYY.dbo.deletadosCadastroTeste' is not supported in this version of SQL Server
I have any possibility in do this, because I use azure server and I need change informations between tables.
My SQL code:
INSERT INTO deletadosYY.dbo.deletadosCadastroTeste VALUES (19,'Michael', 'Street Los Angelos', 25, '1998-12-25')
3+ part naming isn't supported in Azure SQL Databases; they are contained databases, meaning that the reference to the database isn't permitted.
Omit the database name and connect to the correct database in your connection string (or switch the database context if you're in SSMS/ADS/etc). Then your statement would simply be:
INSERT INTO dbo.deletadosCadastroTeste ({Your Column List goes here})
VALUES (19,'Michael', 'Street Los Angelos', 25, '1998-12-25');
I am setting up a Polybase against Azure CosmosDB (MongoDB API) in SQL Server 2019 and I am stuck creating a external table.
I created one sample document in Cosmos DB with following definition:
{
"_id" : ObjectId("5ecc3fcd7791b617982fefa0"),
"id" : "1",
"products" : "2009",
"item" : "Car",
"type" : "Racecar"
}
Snipped from Azure portal for sample collection
When I run following statement:
CREATE EXTERNAL TABLE mongodb.Products
(
[_id] NVARCHAR(24) COLLATE Latin1_General_CI_AS NOT NULL,
[id] NVARCHAR(10) COLLATE Latin1_General_CI_AS,
[products] NVARCHAR(10) COLLATE Latin1_General_CI_AS,
[item] NVARCHAR(10) COLLATE Latin1_General_CI_AS,
[type] NVARCHAR(10) COLLATE Latin1_General_CI_AS
)
WITH (
LOCATION='Sales.Products',
DATA_SOURCE= CosmosDB
);
I get a message:
Msg 105083, Level 16, State 1, Line 1
105083;The following columns in the user defined schema are incompatible with the external table schema for table 'Products': user defined column: 'id' was not found in the external table, user defined column: 'products' was not found in the external table, user defined column: 'item' was not found in the external table, user defined column: 'type' was not found in the external table. The detected external table schema is: ([_id] NVARCHAR(24) COLLATE Latin1_General_100_CI_AS NOT NULL).
Connections seems good. If I change Sales.Product I will get a message that table does not exist.
I was finally able to get this solved. It seems if you are trying to connect to Azure CosmosDB Mongo DB API you will need to edit a file in your SQL Server.
You need to locate C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\Binn\Polybase\ODBC Drivers\PolyBase ODBC Driver for MongoDb.ini
and change two lines
From (does not work):
Driver=PolyBase ODBC Driver for MongoDb\2.3.8\MongoDBODBCsb64.dll
Setup=PolyBase ODBC Driver for MongoDb\2.3.8\MongoDBODBCsb64.dll
To (works)
Driver=PolyBase ODBC Driver for MongoDb\MongoDBODBCsb64.dll
Setup=PolyBase ODBC Driver for MongoDb\MongoDBODBCsb64.dll
This was a solution provided by Microsoft support team.
SQL Server
ALTER TABLE Students
AlTER COLUMN Name nickname
I want to ALTER Name column datatype to be as that of the nickname column datatype but an error occurred like:
Msg 2715, Level 16, State 6, Line 1
Column, parameter, or variable #5: Cannot find data type nickname.
Following the example from w3schools on SQL tutorial, there was an example that talked about changing the datatype of one column using another, I tried it on SQL Server Management Studio but it didn't work.
Exclude a post deployment script in Visual studio 2013 SQL Server project. I am not explaining the whole requirement why I have to do this. I am explaining part of my issue; please bear it.
I have the following script:
CREATE SCHEMA [College]
CREATE TABLE [College].[Department]
(
[Name] varchar(50) NOT NULL,
)
In a post deployment script I have a script file which is not included in the build, and I am inserting a value in the department table:
INSERT INTO [College].[Department]
([DeptId], [DeptName])
Values('77ACE81C-7C41-4A31-8F39-9814E36548A1', 'Computer')
As my department table doesn't have Department Id, I want to exclude this script, so based on a condition I am including this file by taking the help of a command-line variable. My post deployment file has the following entry:
IF('$(UseDepartMent)' = 1)
BEGIN
PRINT N'Command Line UseDepartment is 1'
:r .\Script.DepartMentTableEntry.sql
END
GO
(90,1): SQL72014: .NET SqlClient Data Provider: Msg 207, Level 16, State 1, Line 47 Invalid column name 'DeptId'.
I would like to get a list of Active Directory users along with the security groups they are members of using SQL Server 2005 linked servers. I have the query working to retrieve records but I'm not sure how to access the memberOf attribute (it is a multi-value LDAP attribute).
I have this temporary to store the information:
DROP TABLE #ADUSERGROUPS
CREATE TABLE #ADUSERGROUPS
(
sAMAccountName varchar(30),
UserGroup varchar(50)
)
Each group/user association should be one row.
This is my SELECT statement:
SELECT sAMAccountName,memberOf
FROM OpenQuery(ADSI, '<LDAP://hqdc04/DC=nt,DC=avs>;
(&(objectClass=User)(sAMAccountName=9695)(sn=*)(mail=*)(userAccountControl=512));
sAMAccountName,memberOf;subtree')
I get this error msg:
OLE DB error trace [OLE/DB Provider 'ADSDSOObject' IRowset::GetData returned 0x40eda: Data status returned from the provider: [COLUMN_NAME=memberOf STATUS=DBSTATUS_E_CANTCONVERTVALUE], [COLUMN_NAME=sAMAccountName STATUS=DBSTATUS_S_OK]].
Msg 7346, Level 16, State 2, Line 2
Could not get the data of the row from the OLE DB provider 'ADSDSOObject'. Could not convert the data value due to reasons other than sign mismatch or overflow.
Looks like this is a limitation that cannot be directly overcome: - TSQL: How to get a list of groups that a user belongs to in Active Directory. OpenQuery cannot handle multi-valued attributes.
I ended up writing a .NET CLR job to handle this.