sql-server

T-SQL dynamic subquery

There was such a problem, there is a query in which the table needs to be constantly changed, I would like to put it in a var ... o_log and (case when exists (select r.id from [rfiles].[dbo].[rfiles_01022020] as r where r.id = m.people ) then

"array" in ms sql (for xml)

Hello everyone! I began to learn the query language ms-sql and as a task set for myself, I try to transfer to the xml side co ... r>8-801-555-35-35</TNumber> </Person_info> </Person_INFOs> </Bundle> </Persons>

mdf & ldf (MS SQL) - import to PostgreSQL

There are two files from the MS SQL database-mdf and ldf. The task is to get the data from there and transfer it to PostgreSQL. Is it possible? If so, with what and how?

How do I run a python script using xp cmdshell from sql-server?

Python 3.8.5 is installed on the server. If you run the file bot.py from the command line, then everything works. But I need ... TEWAY\MSSQL_TELEGRAM -d Problem -i C:\Python\Telegram\bot.py' The same mistake. How do I run this one script without errors?

How to install SQL Integration Services

I need to copy the maintenance plans. I decided to finish installing Integration Services. Pre-installed: ...rebooted, ... s - x32 version. Perhaps this is the case? But I can't find how to download the x64 version of Server Management Studio.

Relationships between tables. SQL Server

Tell me if I'm starting to build the database correctly: So far there are 3 tables: dbo.Exam, dbo.Offset, dbo.Session. The ... straint id primary key(SessionId, ExamId, OffsetId) ) P. s how can I then refer to id dbo.StudentSession from other tables?

It is not possible to arrange connections by MSSQL keys

Hello, there is such a problem, I want to put a connection from fact to dimension2 by the KOATUU key and from dimension3 to d ... ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY] ) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]

Testing the MSSQL database

Good afternoon! Are there any tools for automated database testing on MSSQL? For example, projects for Visual Studio (the templates of which I did not find in the studio itself)? Share your experience and links. Thank you in advance.

How do I give the MS SQL database role the right to create and modify tables and other objects?

Hello everyone There was such a problem: there is a database with such a scheme: You need to create 3 roles: Full access ... as well as built-in functions and triggers through the database roles. SQL Server Version 13.0.5026.0 2016 Developer Edition

MS SQL Server-many-to-many communication.

Hello there! We have 2 tables: "Book", "Author". It is assumed that one author can be the authors of many books, and 1 book c ... iate table 2 columns-knigaIDN and AutorIDN, the primary key here is the Author with me. Can you tell me what I'm wrong about?

Automatic partitioning of MSSQL 2012 tables

There are two tables Tab1 | id | time | Tab2 | id | id_tab1 | value | You need to partition both tables, in the first table ... tially, only the section in which I will change the ranking range will change, or will the entire table be partitioned again?

SQL query to the bookstore database

There is a database with two tables. The first table shows information about the books. The second table contains a list of b ... will output a list of all publishers and for each publisher will output the book name of that publisher with the most pages.

Is there a SQL Server equivalent of the IsNull() function in Oracle?

In SQL Server, you can use the function IsNull(expression, replacement), to determine whether the result of the expression is NULL, and replace it with an alternative value in this case. Is there an equivalent function IsNull() in Oracle?

How to make an sql query to select data that is not initially available (T-SQL)

There is a table with the date field, the records indicate the changes of employees on a certain date (Id int, ShiftDate date ... create a query that will output all the dates for a certain period of time, during which no one had a shift. In sql server.

Sql script loop

I have a table with users and I pull out all the IDs from there in the same way: SELECT UserID FROM Users Now, for each ID ... om this list, I need to perform certain operations (with other tables using these IDs) Tell me how to organize a loop in SQL

How do I save a SQL Server database in an SQL script?

There is a SQL Server database. By what means is it possible to translate it into an SQL (or T-SQL) script so that it creates all the tables itself, and so on?

Deleting a column from a table

How do I delete a column from a SQL Server table?

Formulas for fields in MSSQL SERVER

Hello! How can I create a calculated field in mssql server? For example, there is [field 1] and [field 2], which should be ca ... f the first field, for example, from...to..., then field 2 will have one value, and if field 1= from...to..., then - another.

Update via a While loop

Tell me please: There is a table t1 in it there are fields let's say ID, FirstValue, secondValue ID FirstValue SecondVal ... ры 1.2 партнеры 5 1.2 партнеры Газпром 6 1.2 партнеры USA Tell me how? it is possible in words)

How do I add new records to a SQL Server table with the AUTO INCREMENT / IDENTITY column?

There is a CSV file with completely matching columns with an existing SQL Server database table, except for one - in SQL Serv ... ql+pyodbc://имя_юзера:пароль@мой_дсн') датафрейм.to_sql("[dbo].[название_таблицы]", engine, index=False, if_exists="append")