Newest 'sql-server' Questions

Q&A for professional and enthusiast programmers

How do I setup a ColdFusion datasource properly for a SQL Server database through Windows Authentication?

At my workplace we are trying to connect to a Microsoft SQL Server database on a different server. Our server is a ColdFusion server that runs the service through a proxy AD account. The owners of the ...

Find values which are present in all columns in a Cable

I would like a SQL Server query which finds the Values in a cell which fills multiple columns. For example, if I have table ID Value1 Value2 Value3 1 2 NULL NULL 1 ...

How to select specific number of rows depending on condition from a table using sql qeury?

I am storing photo images in sql server database. The images are stored using a field called PhotoType. PhotoTypes are many - some of them are: CheckList, Installation, Audit, SignOff ... Now I want ...

Set the background color property on the report body?

I have a in report sql server 2008. Report have conections to different DB and several datasets. I want to have certain background color in body report when that field get certain value. I use ...

Update Stored Procedure - only update certain fields and leave others as is

I'm currently making a stored procedure which will update a products details. I want to make it (if possible) so that only the fields entered under 'values' column when being executed are updated and ...

Manage access permissions to specific directories in SQL Server FileTables

Lately, I have been working and experimenting with SQL Server 2012 FileTables, that I am implementing into a .NET/WPF workflow application, for some basic file management and sharing operations. I ...

How can I connect Microsoft Excel (via PowerPivot) to my XAMPP Based SQL Database?

This is an odd one, works perfectly well on my home PC (desktop) where both Microsoft SQL Server 2016 and XAMPP are installed. I simply have to stop all the MSSQL services and then (through "Use ...

SQL:How to get the data from a file based on a certain character pattern

I have a data file where I bulk insert data into my staging table. This file has a sequence like that on certain lines. 0123456789 0122580000 2017092 2017092 300,000.00 10,000.00 ....

try-catch clause doesn't work with

When I feed an illegal value to "ID", I expect the "try" to fail and trigger the "catch" clause. PreparedStatement ps1=conn.prepareStatement("insert into Table_1(id values(?)"); try{ ps1....

First item of the Dropbox is not working when the page first load using C#

The first item of the Dropbox is not working when the page loaded but if select the second item in the Dropbox the form will populate with the relevant data. If I come back to first item selected ...

SQL variable for Database Name

I am trying to pass a database name in as a parameter and execute some dynamic SQL. As a test I created this: declare @HRMSDatabase_1 nvarchar(50) = N'FirstDatabase', @Example_1 nvarchar(max)...

Getting error while passing value to sp_xml_preparedocument

DECLARE @xml XML; SET @xml = N'"<?xml version=\"1.0\" encoding=\"utf-16\"?><NominalIds><Id>6416</Id><Id>9</Id><Id>6405</Id><Id>6400</Id><...

How to effectively sort nvarchar containing numbers and letters?

I'm having some troubles sorting a table effectively (the table contains a big amount of rows so any optimization would make a big difference). What I currently have that gives the correct result (...

Need explanation of how passing SSRS multi-value parameters to SQL works

I inherited several SSRS reports from someone who is no longer with the company. The reports pass multi-value parameters to a SQL stored procedure. That SP then uses a split function in the WHERE ...

How to return function columns with null values

I have a function with about 40 columns with null values and these columns have never been used for the past 5 years. So I want to write a query that confirms that these fields have null values. I ...

SQL 2016 & SQL Server Data Tools 2015 Errors at deployment not in english

Can I switch the Errors back in English without changing the Regional Settings? Since the errors at current language are not use and changing the settings at the Machine that I deploy from is not an ...

Not able to insert records into database with asp.net

I want to insert records in my database with asp.net, but it is not really working out well. The data types of the colums in my database are all varchars, except for the randomID. But I still get this ...

Parser NULL (DTEParseMgd)

Error while creating sql jobs (Parser NULL (DTEParseMgd)) sql version Microsoft SQL Server 2016 (SP1-GDR) (KB3207512) - 13.0.4199.0 (X64) Nov 18 2016 15:56:54 Copyright (c) Microsoft ...

Using Triggers for Update

People tell me that using triggers is resource intensive and costly. I'm struggling to get my head around why in my particular instance. I've recently had to add "auditing fields" to some 50 tables (...

insert into sql database from selecting columns from excel

I tried using insert into.. select method as below to insert the data from excel into sql, Insert into table_fruits(type, weight, cut, date_import) SELECT type, weight, 'Yes', GetDate() from ...

Spliting rows into columns when value occurs in SQL Server

I have a a table with this values : ITPROD PROD1 PROD2 Quantity 1 Quantity 2 45842 69640 63908 3 2 70690 91387 90734 1 2 The result table should ...

Issue with connecting android studio to MS SQL server

hi this is my first post so go easy on me, im currently trying to connect a login system i have designed on android studio to a microsoft SQL server using AWS as my host. when executing the code i am ...

Sql total minutes between records

I am trying to make a query that returns me the number of minutes that a person has worked. A person can have many entries and exits the same day. I would like to know the total number of minutes ...

sql query not working if come as a string

I'm trying to exec sql SP, and add a "select" to the query. it is working fine, but if I add the "between" I get an error. this is the code: DECLARE @query as nvarchar(200); SET @query = N'...

Recursively generate hierarchy for any given node in the tree?

This CTE fetches the hierarchy of SuiteIDs and ParentSuiteIDs as the result set below. I want to pass the SuiteID and all SuiteIDs that are parents with their respective level. WITH HIERARCHY AS ( ...

Error using SSMA to migrate Data from Access to SQL Server

I am trying to use the SSMA to migrate two Databases from Access 2007 to SQL Server 2014. The SSMA recognizes the Access DB's but the tables and queries show as zero. I have ammended the permissions ...

How To Pivot table using SQL server

i creating SQL table its have three column fields NAME TYPE Amount RAJ 401K % 500 Kumar ROTH 600 RAJ 401K % 500 ...

Large sql table using last_value+over

First of all, I'm not a DBA and this post my contain some ugly sql code. :) Context I have a table that represents all my product stock activities (in the SQL "TP_MOVI"), since the beginning of the ...

How to drop and recreate indexes without growing the transaction log

I wanted to change a field in a database table to be a calculated field rather than being populated using a trigger. I am using Entity Framework database first so I added this sql to a migration to ...

SQL Server equivalent of Oracle 'byte'

SQL Server equivalent of Oracle 'byte' I'm looking for the SQL Server equivalent of the Oracle datatype byte. I searched for it in this documentation page (Data Type Mapping for Oracle Publishers), ...

SQL - find mis matching values in two tables

Ok, here is the issue. Have two tables: - t1 - t2 Using two fields from both: - product - POSTED_TRAN_AMT (in t1) - BEG_AUM_AMT (in t2) I want to find a product for one period (AP=202, FY=2017) ...

Equivalent of OracleParameter [C#/.NET/SQL Server]

I working on a database migration (from Oracle to SQL Server) and in this context, I need to change the DAL layer of an ASP.NET project. Part of this is finding the SQL Server equivalent of the class ...

Issue with STRING_AGG WITHIN GROUP and Visual Studio

I am using Visual Studio 2015 and having an issue in my SQL Server database project with STRING_AGG WITHIN GROUP. SELECT [Continent], STRING_AGG([Country], ', ') WITHIN GROUP (ORDER BY [Country]) AS ...

SQL Find Records in Another Table Based (Using Like?)

I have been unsuccessfully trying to get this to work for the past 2 days and hope I can find someone who can help. One table contains major events and the other contains minor events based on the ...

Sql query including a unicode character returns wrong result

I have a query like this: select * from Table where column1='bäb' This query returns a result in SQL Server, but if I write it in RStudio: res <- sqlQuery(dbhandle, "select * from Table where ...

Database Design - Multiple Category and Multiple Sub Category

I have a question on how to design for multiple category and multiple sub category. A store will have multiple Categories and multiple sub categories. For example, Stores will have Women's clothing, ...

Convert Oracle collection type to SQL Server

I'm working on a database migration (Oracle to SQL Server) using the SQL Server Migration Assistant for Oracle tool by microsoft. However I get the following error message while performing the db ...

The databases 'Operational' in server 'sql01' and 'Staging' in server 'sql01' are already in a replication relation

I am trying to configure my release process in VSTS to clone my live database to my staging envirnment before deploying the buld to staging. FOllowing guidelines here... http://community.idera.com/...

how can I save the data from a text editor in sql server using c#.net?

I am just developing a QA forum. And I have used a text editor to post a question. I want to save the question asked in sql server 2014. how I can do this?

R: [unixODBC][Driver Manager]Can't open lib 'SQL Server' : file not found

setwd("/mnt/mountpoint/abc/") sqlServerConnString <- "SERVER=server;DATABASE=sqldwdb;UID=xyz;PWD=abc;" sqlServerDataDS <- RxSqlServerData(sqlQuery = "SELECT * FROM xyz", ...

Syntax error in SQL RDS server for create table

I have requirement to update the created date and updated date column in MS sql server. I'm using below query to do the same. But while executing the query i'm getting a syntax error saying "Syntax ...

convert trigger from FB to MSSQL

I need your help. I use a trigger for Firebird Database. Now I have changed to MSSQL 2014 Database. I have one trigger and I could not convert this. Please give me your help. I need the following ...

I need to export sql server results to new excel work book?

I need results into a new workbook, at present am getting the results in existing workbook? Sub ConnectSqlServer() Dim conn As ADODB.Connection Dim rs As ADODB.Recordset Dim sConnString As String ...

File inserting into filestream directory, but not into SQL Server 2012 table. C# ASP

I'm having difficulty setting up my database to accept files. I don't fully understand what I'm doing so it will be something silly for sure. I'll try to include as many images and as good a ...

MsSQL query from remote ubuntu machine to MsSQL database via pymssql is too long

My infrastructure is in Microsoft Azure environment. Also I have an Ubuntu virtual machine in local network. First I execute a query in SQL Management Studio and it works less than a second. Then I ...

SQL Server - Stored Procedure Insert Duplicate record at same time

Why Stored Procedure insert this SP in duplicate record? But its just happen for 5-6 case from 100 case. this SP insert duplicate record at same time, its like 2-4 record. How to avoid this issue? I ...

Render parts in SSRS report asynchronously

I'm trying to create an SSRS report and I'm using a lot of SQL queries there. I have several tabs that shows different data to the user. Can I render the stored procedure in all the tabs ...

ssis package default Project variables

I have a dtsx package and I am looking at the xml in notepad++. Here is the part that I have a question about: <SQLTask:ParameterBinding SQLTask:ParameterName="@ExecutionId" ...

Where on hasmany in sequelize with count

I am not the best at UML/database diagrams but the following hopefully shows my DB design (MsSQL) I have a "Location" table with zero to many pallets assiociated with it (there are 0-many pallets IN ...

Entity Framework connection string without password

before I was using a connection string with integrated security. Now I switched it to username/password and created a new user in my SQL server. I generated a new connection string with the server ...
Translating... 0%