Questions tagged [sql-server]

Microsoft SQL Server is a relational database management system (RDBMS). Use this tag for all SQL Server editions including Compact, Express, Azure, Fast-track, APS (formerly PDW) and Azure SQL DW. Do not use this tag for other types of DBMS (MySQL, PostgreSQL, Oracle etc.). Do not use this tag for issues on software and mobile development, unless it is directly related to the database.

0
votes
2answers
19 views

Flag top 90% of rows in each partition of table

I have a table as below. I want to derive a column Flag such that approximately Top 90% of rows for each partition will have TypeA and remaining 10% of rows will have TypeB as a flag in it. +------+--...
0
votes
0answers
7 views

How compare in Microsoft sql server 2012 management studio sql with collation character set encoding

I've create SQLQuery with "Select Top 1000 Rows" in microsoft sql server 2012 management studio "Object Explorer": SELECT TOP 1000 * FROM [WSS_Content].[dbo].[UserInfo] Then add at the end of query: ...
0
votes
1answer
15 views

Can't able to create temp table using Dynamic query

I am trying to create a temp table in MS sql server. It's shows like table is created and value(s) are inserted. While using Select query, it throws an error. My sample code is EXEC ( '...
0
votes
1answer
20 views

Performance for Avg & Max in SQL

I want to decrease the query execution time for the following query. This query is taking around 1 min 20 secs for about 2k records. SELECT Col1, Col2, ISNULL(AVG(Col3),0) AS AvgCol, ISNULL(MAX(Col3),...
0
votes
1answer
18 views

Getting order number containing multiple item numbers

I am working on a project in SQL Server where I need to find how many orders contain multiple products. For example there is an order number of 1 and it has multiple records 1 for style a and one for ...
0
votes
0answers
13 views

sql sevrer to produce values from left table if found combination of three columns in another table?

We have two tables XYZ and PQR. First having 30 columns and second having 15. of which three column name are same a,b,c in both. using a unique combination of these three columns from table XYZ I need ...
0
votes
0answers
18 views

How to move distinct column rows from main table into calculated table column in ssas tabular model

I've got an SSAS tabular model with a column that hold date values.I have huge data in main table so I want to move distinct start date values into calculated table column. I have used below dax ...
0
votes
0answers
16 views

How can I change password for sql login to datatbase using pyodbc in python

I try change password for sql login to database using pyodbc in python But I get error - Wrong syntax near object "@P1" (102) (SQLExecDirectW).....Cannot prepare the instruction (8180) config.login ...
2
votes
0answers
24 views

Ef Core vs Linq on interpolated string

Using interpolated strings to send sql server queries, why with a datacontext on LINQ to SQL you need to add single quotes ? db.ExecuteCommand($"delete table where date = '{date:yyyy-MM-dd}'"); ...
0
votes
0answers
17 views

Best practice in sending nodejs socket changes to SQL Server?

I have a NodeJS Socket.io server which handles all data and user experience. I'm looking for advice in how to best approach sending these data changes to an SQL Server when the incoming message ...
-1
votes
2answers
36 views

Need help to display data from SQL Server Database query in Java Jtable

I've created a database using MSSQL now I'm trying to display data from different database tables in a java Jtable. I am new to this and I don't really know how to do it. Using a query or smth? I've ...
1
vote
0answers
22 views

Service Broker is working only first time

Service Broker is working only for the first time. I am new to service broker and learning the same. Doing it for the first time. I suspected that it is working only for the first time so i changed ...
-1
votes
0answers
12 views

groovy SQL server connection setup url issue

I'm trying to connect to MySQL server using groovy below is my connection string def db = [url: "jdbc:sqlserver://xxx.xx.xx.xx:1433",user: 'abc', password: 'pwd', driver:'com.microsoft.sqlserver....
1
vote
1answer
15 views

SSIS Script Component - get raw row data in data flow

I am processing a flat file in SSIS and one of the requirements is that if a given row contains an incorrect number of delimiters, fail the row but continue processing the file. My plan is to load ...
0
votes
1answer
62 views

How to avoid loosing precision using implicit conversion (SqlParameter) with DateTime (C#) even if I am using DateTime2 in my SQL Server?

This is my definition column in my database. I have a problem with DateTime in C# and the value that is being saved into my database SQL Server. When the applications sends: 2019-06-14 17:10:39....
-1
votes
0answers
25 views

Insert data from file

I insert data from file to datastage. but i add number 30 , but when insert into table in datastage it changed into 30.000 . Datatype in table must be varchar. How to fix this error
0
votes
1answer
16 views

SQL Express - Could I partition an exisiting table to solve 10GB file size limitation?

One of our custom reached the 10GB size limitation of SQL-Express edition. There are 2 tables contains too many training data. Could we partition tables on sql express edition? Is there any help link ...
0
votes
0answers
21 views

Converting Unix Time in SQL [duplicate]

I need to convert UNIX time in SQL ,and get the number of unique user IDs (with at least 1 action) on July 2017,split by platform. I have the following table : user_id unix_timestamp platform Action ...
0
votes
1answer
25 views

datagridview columns in VB.net

I have 7 tables of COA as shown in the picture attached. What I need is whenever opening balance goto - (negative), the type must automatically show CR sign and whenever that account goto positive +, ...
6
votes
3answers
53 views

Find the record count of the derived table in SQL Server

CREATE TABLE Temp ( ID Int IDENTITY, Name Varchar(100) ) INSERT INTO Temp SELECT 'Elby' UNION ALL SELECT 'Eljo' UNION ALL SELECT 'Elsy' UNION ALL SELECT 'Elsy' UNION ALL SELECT '...
-4
votes
0answers
35 views
-6
votes
0answers
28 views

How to apply pagination After getting records using LIKE In Sql Server

At starting i have 1 lakh records.. After applying Like Operator in sql server (like this '%an%') still i have 54 thousand records... How to apply Pagination on sorting records.. Tell me the both ...
-8
votes
0answers
26 views

An unhandled exception of type 'System.FormatException' occurred in System.Data.dll [on hold]

An unhandled exception of type 'System.FormatException' occurred in System.Data.dll Additional information: Failed to convert parameter value from a String to a Int32.
0
votes
0answers
25 views

How to load data into numpy array from MS SQL Server database

I wish to load data from SQL server to the arrays of numpy. eg: There is a table called x in SQL Server and I need to extract details under the column 'duration' into a numpy array. I need to ...
-1
votes
0answers
34 views

Why do I have (,) on my text when insert data to database

I don't know why I have this comma (,) when I insert data to database. Please help me. This is my code for update data with call stored procedure on SQL Server: private void updateDevice(String ...
-1
votes
1answer
61 views

How to anonymize data in SQL?

I need to anonymize a variable in SQL data (VAR NAME = "ArId"). The variable contains 10 numbers + 1 letter + 2 numbers. I need to randomize the 10 first numbers and then keep the letter + the last ...
0
votes
1answer
34 views

The INSERT statement conflicted with the FOREIGN KEY constraint “FK_Cars_Owners_OwnerId”

I'm creating a new WebAPI on ASP.Net Core 2.2 and I need to define a relationships between two models in SQL Server: Car public class Car { [Key] public Guid CarId { get; set; } public ...
0
votes
1answer
28 views

Add second database with website pullng information from both databases?

So my website is currently pulling stock information from "J" warehouse in a database called InvWarehouse, now we want to add "JT", so that it pulls from both "J" and "JT" We have a scheduled stored ...
0
votes
0answers
13 views

How to version control SQL Server database with changes comming from outside?

I'm looking for some solution on how to version control my SQL Server database. I've got an existing database and need to develop a new app over it. The problem is, that until the new app is developed,...
0
votes
0answers
22 views

why is '£' changed to '£' in my imported dataset

I have just attempted to import data into sql server for the first time and it worked. The only issue was the '£' value in the symbols column changed into '£'. I changed the value back to '£' with ...
0
votes
1answer
30 views

How to fix “conversion failed when converting the varchar value 'is turned' to data type int”

I did some changes in my IMOS database and got it working but when my customer tried the same they ended up with an error. When searching from google I think the line needs some CONVERT(...) included ...
0
votes
2answers
23 views

Crystal Report Error-Could not load file or assembly

I design ERP for my company and it is working fine. On reports side I am using crystal reports 2008. On my developing Laptop reports are working fine but on user side I am getting error I tried &...
-2
votes
2answers
37 views

Split string function in SQL Server [duplicate]

In SOL Server, I get the value for the parameter, @codeName, as "1023 - Hydrabad" from ASP.NET. @codeName = "1023 - Hydrabad" I want Hydrabad alone. How to split it?
0
votes
0answers
27 views

Deadlock on a table which has a view in SQL Server

We have a table in SQL server on which there exists a view. The view is being read by a job every 10 seconds. Another job tries to update the underlying table and gets a deadlock exception. Can ...
1
vote
0answers
27 views

SQL Server Management Studio 64 bit installation problem

I was running this fine on my current laptop but it was the 32 bit version. I recently upgraded Office to 64 bit and as part of this process I had to uninstall all 32 bit Microsoft products, including ...
-1
votes
1answer
32 views

Searching best practice for passing data between vaadin UIs [on hold]

I am new to vaadin and I am trying to build a web application with multiple pages using data from SQL Server. Thanks to my research in several StackOverflow topics I could get the first page to work, ...
1
vote
2answers
43 views

How to combine lines in sql query with two inner joins?

In my SQL Server 2014 I have 3 tables. In one table is user information, in the other group information and in the third one are the dependencies of the users and the groups. I've just set up my ...
-1
votes
0answers
23 views

How to perform an upsert using batch in java

I need to perform an upsert using batch for processing very large volume of data. I need to insert records if they are new and update if already exists. I was able to either insert or update but ...
-2
votes
0answers
35 views

Error converting data type varchar to numeric. What are the solutions? [on hold]

select DATE, convert(datetime, Cast(DATE as varchar), 100) as DATES from EMP where LEN(DATE) = 8 AND ISDATE(DATE) =1 AND DATE < '2017-06-30' Error converting data type varchar to ...
0
votes
1answer
30 views

SQL Server uses db_owner prefix in selects on client's database

My Django app is normally working on SQLite3, but this time I had to convert it to use SQL Server. On test server everything went well, but when my friend copied this database to client's server I had ...
0
votes
0answers
84 views

how to show repeated date value as null in SQL Server?

I have a SQL Query SELECT DISTINCT DENSE_RANK() OVER(ORDER BY bsContract.ContractNumber DESC) AS RANKS, ROW_NUMBER() OVER(PARTITION BY bsContract.ContractNumber ...
-3
votes
2answers
23 views

How to Get Month Short Name from Yearmonth Column

I have a column in SQL Server named yearmonth e.g. 201906. I want to show the monthname from that column, but can't find a way to show it.
1
vote
0answers
40 views

Sub select in linq to sql

I have the following linq query: select new EmployeeModel { Title = (emp.DEPT == null ? tmsg.Label : db.DEPARTMENT.Where(o => o.Id == emp.DEPT).FirstOrDefault().DEPARTMENT_TRAD.Where(o => o....
0
votes
0answers
19 views

Unable to connect to Server: WIN-71KGFN2PPCC\SQLEXPRESS in C:\inetpub\wwwroot\index.php on line 7 Something went wrong while connecting to MSSQL

I have tested my MS SQL Server connection with this PHP code: <?php // Server in the this format: <computer>\<instance name> or // <server>,<port> when using a non default ...
2
votes
0answers
29 views

Query Performance - Fetch rows where subfiles are not being fetched from the rows

I am creating a web based file explorer where the details of files and folders are stored in the database and are shared with Active Directory users or groups. When I have to bind the grid with shared ...
0
votes
3answers
36 views

Convert nvarchar to datetime - format 19/02/2019 12.00.00 AM

I want to convert 19/02/2019 12.00.00 AM format to datetime in a stored procedure SQL Sercver 2012. I tried select cast('19/02/2019 12.00.00 AM' as datetime) and select convert(datetime, '19/02/...
-2
votes
0answers
31 views

How to restrict the users from entering duplicate data in different timestamp in SQL Server and VB.net? (to control in both side)

I encountered some of the problems in my project lately. Users insert the transaction data into my transaction table in SQL Server. However, it turns up to appear two identical lines with different ...
0
votes
1answer
25 views

Trying to compare two tables and add same EPC value to another table

I'm trying to compare two columns in two different tables in a same data base (PriorityLevel table EPC column and table3 EPC column). Different values of EPC in these two tables is going to table2. ...
1
vote
1answer
28 views

How to convert table to flat file with each field on new row

I have a pipe delimited file with user and address information in the following format: userid|name|street|city|state|zip 123456|fred|123 apple st|Navada|MO|64772 I to output the information ...
0
votes
1answer
20 views

Is it possible to install both SQLPS and SqlServer PowerShell module on Windows 10?

C:>$PSVersionTable.PSVersion.ToString() 5.1.18362.145 When I use Install-Module -Name SqlServer, it reports: C:>Install-Module -Name SqlServer PackageManagement\Install-Package : The following ...