Questions tagged [SQL Server] (1022)

1
answer

Replication from MySQL to SQL Server. If you want to use?

The last few years to replicate live data use Oracle Golden Gate, maybe there are some simpler alternatives.
Gage67 asked April 19th 20 at 12:41
1
answer

How to set the path of the request file in a database for bcp?

Unload the data from the database. bcp "select * from table" queryout "Result.csv" ... -- here everything is clear. But I have a very large query that is stored in the file. I want to write something like: bcp "c:\query.sql" queryout "Result.csv" ... But it doesn't work. Couldn't find the manual.
Sydnie41 asked April 18th 20 at 12:44
1
answer

How to rewrite the query in Ms Sql PosgreSQL?

There is a piece of request convert(varchar(10), shag, 104) + '' + convert(varchar(10), shag, 108) shag I rewrote concat(convert(varchar(10), shag, 104), ' ', convert(varchar(10), shag, 108)) shag but now swears by convert message: SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near "," concat(convert(varch...
adrain.Litt asked April 18th 20 at 12:26
1
answer

Is there a simple solution to move a subtree hierarchyid in mssql?

I have a hierarchical data structure: CREATE TABLE [Employees] ( [Id] INT identity(1, 1) PRIMARY KEY ,[Hid] HIERARCHYID NOT NULL ,[Name] VARCHAR(50) NULL ,[Secondname] VARCHAR(50) ,[Surname] VARCHAR(50) ,[BossId] INT FOREIGN KEY REFERENCES [Employees]([Id]) ,[PositionId] INT FOREIGN KEY REFERENCES [Positions]([Id]) ...
lavern80 asked April 18th 20 at 12:21
2
answers

How to update multiple rows in a single query in MS SQL?

Hello! There is a table with two lines: I need to update or one row or both at the same time, and in each case, the fields Lat and Lng are updated together. Written request: INSERT INTO MyGMap (id, Lat, Lng) VALUES (1,'1','2'), (2,'3','4') ON DUPLICATE KEY UPDATE id = VALUES(id), Lat=VALUES(Lat), Lng=VALUES(Eng) Gives an ...
Ashley.Macejkovic asked April 16th 20 at 11:12
1
answer

How to optimize the server Aps.Net + SQL?

There are 2 servers: 1 - the server on which the spinning of the application. 2 - the server where you deployed SQL Express DB from app 1, the server defines the parameters of connections to the database server. The problem is than, long data loading from the browser. It helps to restart the database server. It's a fun ...
priscilla39 asked April 16th 20 at 10:35
2
answers

How to calculate the sum using recursion in SQL?

There is a challenge: For every 1000 in the customer receives 1 bonus point. If you spend for example 3400р - get 3 bonus and 400r are added to your next purchase. There is a table purchases (id, customer, date and time, purchase Amount). You must use recursion to calculate the number of bonuses received for each purchase....
dee.Ter asked April 16th 20 at 10:12
1
answer

How to replace text in the SQL table?

Microsoft SQL need to replace the lines to another text.
katlynn_Heidenreich13 asked April 9th 20 at 10:18
1
answer

Not works correctly in sql query, what could be the problem?

There is a request in this format SELECT * FROM `t1` JOIN `t2` ON `t1`.`pav` = `t2`.`pac` RIGHT JOIN `t3` ON `t3`.`objid` = `t2`.`objid` WHERE `t2`.`objid` IS NULL OR `t2`.`date` > '.....' Not displays all the rows from the table t3. Displays 3 lines, although table t3 95 Tell me, please, why
adalberto asked April 9th 20 at 09:51
1
answer

How to add a variable Python to the SQL query?

Tell me how to add a variable to the query? The project is a chat bot using dialogflow. When receiving a specific command you want to record client data into the database. How to transfer data received from the input line to a database on MS SQL server? A little googling and did this: print('Enter message...') message = i...
Timothy.Farrell asked April 9th 20 at 09:44