Synapse SQL: Error in Inserting url link into Synapse Table - sql-server

I am facing issues while INSERTing a URL into Synapse Table.
DECLARE #today datetime;
SET #today = CURRENT_TIMESTAMP
INSERT INTO table_url([APITag]
,[AuthAPIUrl]
,[DataFetchUrl]
,[CreatedOn]
,[CreatedBy])
VALUES
('Indent',
'https://beta-url.<url_name>.com',
'https://beta-url.<url_name>.com',
#today,
'Abcd')
But the above statement is giving error:
Msg 104455, Level 16, State 1, Line 1
USE statement is not supported to switch between databases. Use a new connection to
connect to a different Database.
Msg 103010, Level 16, State 1, Line 3
Parse error at line: 11, column: 12: Incorrect syntax near ','.
Don't know what I am missing here. Is there any way to convert the URL into string?

After reproducing in my environment, I have received the same error.
As per the error, you are receiving this because the USE Database Statement is not supported in Azure synapse. Alternatively, you can connect to your database by directly opting from the drop down as mentioned below from your dedicated pool.

Related

Importing external data to a SQL table to request a result

Salutations,
I am currently trying to pull tag data (ASCII string) from a transaction managing software (softing 56eATManager) to an SQL table (SQL Server 2014) I currently have created. I need the data that I import to SQL to then export a ZPL (zebra printing language) back to the transaction manger and subsequently back to the PLC that the string originated from. The transaction manager is current mapped to the same server that the database is in.
This is in the SQL currently with errors on a few different lines:
use [DATABASE]
declare #workorderID varchar(max)
declare #ZPLcallup varchar(max)
CREATE EXTERNAL DATA SOURCE <Softing tManager>
WITH
( LOCATION = <172.16.0.213>
, PUSHDOWN = ON
, TYPE = BLOB_STORAGE
);
This is the list of errors I am getting:
Msg 156, Level 15, State 1, Line 2 Incorrect syntax near the keyword
'EXTERNAL'.
Msg 319, Level 15, State 1, Line 3 Incorrect syntax near the keyword
'with'. If this statement is a common table expression, an
xmlnamespaces clause or a change tracking context clause, the previous
statement must be terminated with a semicolon.

Microsoft SQL server 2016, cannot create sequence

I have Microsoft SQL server 2016, I am using SSMS to do my DB work. I am trying to create sequences and I keep getting this error
CREATE SEQUENCE dbo.seq_changeid As int START WITH 1 INCREMENT BY 1;
Error
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'SEQUENCE'.
Msg 319, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'with'. If this statement is a common table expression or an xmlnamespaces clause, the previous statement must be terminated with a semicolon.
I have tried it in SQLCMD and it does not work there as well. This is local database that i am using for some testing. I login using SQL Server Authentication.
I even tried select * from sys.sequences and it errors
Msg 208, Level 16, State 1, Line 10
Invalid object name 'sys.sequences'

Invalid column name when running a query in SQL Server 2008

I am trying to run a query in SQL Server 2008. It looks like this:
IF EXISTS (SELECT name FROM sysobjects WHERE name = "Bonds" AND type = 'U')
DROP table Bonds
GO
When I run this, I get this error:
Msg 207, Level 16, State 1, Line 2
Invalid column name 'Bonds'.
Msg 28102, Level 16, State 1, Line 3
This query was created by SQL Server. I am trying to run it in a different computer. Then I face this issue.
I have tried Ctrl+Shift+R as this post: SQL Server Invalid Column name after adding new column. But it is not helping.
Need some guidance on this.
Change
WHERE name = "Bonds"
to
WHERE name = 'Bonds'
Otherwise "Bonds" is treated like a column-name which does not exist.
use single quotes in search condition
WHERE name = 'Bonds'
I think you can also use
SET QUOTED_IDENTIFIER OFF;
before your query.

SQL Server 2012 Change Data Capture Error 14234

I am having problems setting up change data capture on a SQL Server 2012 instance. Whenever I attempt to enable CDC on a table I get the following error:
Msg 22832, Level 16, State 1, Procedure sp_cdc_enable_table_internal,
Line 623
Could not update the metadata that indicates table
[dbo].[TableName] is enabled for Change Data Capture.
The failure
occurred when executing the command '[sys].[sp_cdc_add_job] #job_type
= N'capture''.
The error returned was 22836: 'Could not update the metadata for database [database name] to indicate that a Change Data Capture
job has been added. The failure occurred when executing the command
'sp_add_jobstep_internal'.
The error returned was 14234: 'The
specified '#server' is invalid (valid values are returned by
sp_helpserver).'. Use the action and error to determine the cause of
the failure and resubmit the request.'. Use the action and error to
determine the cause of the failure and resubmit the request.
The name of the server has not changed, I tried the sp_dropserver / sp_addserver solution and receive the following error:
Msg 15015, Level 16, State 1, Procedure sp_dropserver, Line 42
The server 'ServerName' does not exist. Use sp_helpserver to show
available servers.
Msg 15028, Level 16, State 1, Procedure sp_addserver, Line 74
The server 'ServerName' already exists.
As I've stated, I'm trying to set up CDC and not replication. The version of SQL Server is: 11.0.5058.0 (SQL Server 2012 SP2)
I've looked at Error while enabling CDC on table level and tried that solution.
I've also tried:
exec sys.sp_cdc_add_job #job_type = N'capture'
I receive the following error:
Msg 22836, Level 16, State 1, Procedure sp_cdc_add_job_internal, Line 282
Could not update the metadata for database [DatabaseName] to indicate
that a Change Data Capture job has been added. The failure occurred
when executing the command 'sp_add_jobstep_internal'.
The error returned was 14234: 'The specified '#server' is invalid (valid values are returned by sp_helpserver).'. Use the action and error to
determine the cause of the failure and resubmit the request.
Any help would be greatly appreciated.
As listed here, check the names match
SELECT srvname AS OldName FROM master.dbo.sysservers
SELECT SERVERPROPERTY('ServerName') AS NewName
If not, fix with:
sp_dropserver '<oldname>';
GO
sp_addserver '<newname>', local;
GO
The error is caused due to mismatch in value between SERVERPROPERTY(‘ServerName’)) and master.dbo.sysservers
Check these SQLs:
SELECT * FROM master.dbo.sysservers
SELECT SERVERPROPERTY('ServerName')
If your SERVERPROPERTY('ServerName') is not any of the sysservers, then the fix is to change your computer name to match one of those.
Adding the server fixes the issue:
DECLARE #ServerName NVARCHAR(128) = CONVERT(sysname, SERVERPROPERTY('servername'));
EXEC sp_addserver #ServerName, 'local';
GO
I had a similar situation, where I have restored a bak file which I got from another windows machine,which retained windows user account with the old PC name. I had delete the backup, create an empty data base and restore into that. This solved my issue

Collation abbreviation, not sure of meaning

UPDATE:
Running this:
ALTER DATABASE "STRINGSDB.MDF"
COLLATE Latin1_General_CS_AShere
Getting this error:
Msg 5030, Level 16, State 2, Line 1
The database could not be exclusively locked to perform the operation.
Msg 5072, Level 16, State 1, Line 1
ALTER DATABASE failed. The default collation of database 'STRINGSDB.MDF' cannot be set to Latin1_General_CS_AS.
I only have SQL server Management Studio accessing the DB.
ORIGINAL POST:
My SQLEE indicates a Collation of...
COLLATE SQL_Latin1_General_CP1_CS_AS
I am having problems finding the meaning of the CP1, does anyone know what this means?
I also ran...
select * from ::fn_helpcollations()
and the
SQL_Latin1_General_CP1_CS_AS
doesn't exist, also checked...
Latin1_General_CP1_CS_AS
thanks for any help.
From SQL Server Collation Name (Transact-SQL):
CP1 specifies code page 1252

Resources