OGR2OGR with MS SQL on Ubuntu 16.04

I need to access a Microsoft SQL Server with OGR2OGR from an Ubuntu Server 16.04. It is working on Microsoft, so the basic setup is fine. My problem is that when I run my OGR2OGR command (after installing GDAL with sudo apt-get install gdal-bin): ogr2ogr -overwrite -f MSSQLSpatial “MSSQL:server=tcp:<DATABASE_SERVER>,<PORT>;database=<DATABASE_NAME>;uid=<USER>;Pwd=<PASSWORD>;” “<IMPORT PATH FILE>” -nln “<TABLE NAME>” […]

Wrap text when column name is too long?

I have this script that sends an email: USE msdb EXEC sp_send_dbmail @profile_name = ‘Mail list’, @recipients = ‘bob.jones@company.com’, @subject = ‘query results’, @body = ‘Result from SELECT appended below.’, @execute_query_database = ‘DB’, @query = ‘exec usp_DisplayData’ The issue is that many of the columns (or their alias) are incredibly long, so the query result […]

how to import data from two tables into one table in another database

i tried to make backup from a database so i want to import data from two tables into one table in another database i created database whith the same columns with the same types but i got error i want to copy data from examiners and results to enthar_backup and this is my code Select […]

xp_cmdshell SQL Server 2012: How to create a text file with “< , >” characters in it?

I’m trying to create a txt file in a shared folder using xp_cmdshell in SQL Server. The code works perfectly, but I need to begin the text with: “<0600 …” So when I write ” < ” or ” > ” in the query, I get an error: The system cannot find the file specified. […]

How can I get the 3 most frequently-appearing companions here

Table 1 – tblCompanion: companionid | companionname | who played ————————————————— 1 | River Song | Alex Kingston 2 | Rory Williams | Arthur Darvill 3 | Wilfred Mott | Bernard Cribbins 4 | Rose Tyler | Billie Piper 5 | Adam Mitchell | Bruno Langley 6 | Donna Noble | Catherine Tate 7 | […]

SQL Server SQL Statement – Updating record

I have a data as below: I need to update Matching_id and Matching_Type by using column id, region, company, dept, subdept and amountsepend. The logic is: Sum AmountSepend by Region, Company, Dept and SubDept. If the sum amount is 0 then Matching_Type is ‘Match’ and Matching_id is the combination of the id for the matched […]

SSRS 2008 R2 / SQL – How to filter groups but keep detail data?

EDIT – i’m reposting this question in an attempt to explain what i mean better I’m using SQL 2008 R2 and I work for a retail department store and we need a report to show all the sales orders made in each department, and sections of those departments. What i want is to group up […]

SQL Server – Minimize JSON output

I’ve got a SQL Server stored procedure where I do a lookup for a couple of standard/static values, then generate a table of comparison values (1 per person/record). Basically, the stored procedure outputs the following “static” values: Minimum Maximum LowThreshold HighThreshold Those 4 values are the same for every output record, but can change based […]

Get latest record for each ID in MSSQL

I have a table of the form: id | date | metric1 | metric2 … | metricN I want to get the all latest metrics for each id? I can use the GROUPBY function and the MAX(date) to get the latest date, and then join with the table to get the correct row, but is […]

Timeout trying to connect to a database via LinqPad5

I’ve just created a new SQL Server 2014 database on my hosted server, and can connect fine to it using SQL Server Management Studio. If I try connect via LinqPad, and enter my details, click the “Display all in a TreeView” then the Test button is enabled, and if I click it, it tells me […]

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.