Quantcast
Channel: SQL Server Data Access forum
Viewing all 4164 articles
Browse latest View live

Not able to Display Column Totals (Totals Row) in MS Access for Linked Table from SQL Server

$
0
0

When I have the Totals Row showing in Datasheet view of a Linked Table from SQL Server, there is no way I can see how to actually set any Table Type for any column totals (e.g., Sum on a column that is a number).

This feature is described in this article:

https://support.office.com/en-us/article/display-column-totals-in-a-datasheet-using-a-totals-row-8f1f89c4-7f86-4113-a836-291ac3ea446e

The article doesn't mention anything about this feature not supported for Linked Tables.

This does work for Linked Tables from an Access database, just not for a Linked Table from a SQL Server table

Is this an ODBC limitation, ... or is it a feature just not supported in MS Access for SQL Server Linked Tables?  (e.g., from Office Pro Plus 2016).



MS SQL JDBC authentication with JWT Token

$
0
0
I have a need in an application to use the JWT Token from the application and pass through via JDBC to MS SQL Server for authentication.  Is this possible?  Thank you!

MS OLE DB dowload issue

$
0
0

I tried to download the latest version of the MS OLE DB under on the link with the id=56730

However I now have 2 files with the same name "msoledbsql.msi" and no way to figure out which one is 32bit and 64bit version 

Is there a way to figure out which one is the 64bit?

thanks for your time

Connect to Different Zone SQL servers?

$
0
0

Hi All,

Our Company have 500 desktop users and five database zone with SQL servers behind firewall.

Now we want to create a solution for an application to connect from all these 500 user desktop to proxy server in each zone and proxy server to all database servers in that zone. Do we have any proxy server solution for each zone and give access to SQL servers like gateway or any other solution which satisfy this?

Finding Overtime with Conditions Problem

$
0
0

I’m a self-taught TSQLer and leverage a bunch off of this forum.  You guys are a great help.

I use MS SQL Server Management Studio 12.0.2000.8 and MS SQL Server 2014.

My SQL is supposed to find any employee that has over 40 hours in any week (overtime) and, also, that employee has a pay code of 2 on a Thursday of that week.

The SQL below finds overtime OK but I can’t get it to only include folks that have a pay code of 2 on a Thursday of that week.  I can't make multiple HAVING statements without getting an error.

Suggestions please.

Expected results from test data below:

EmployeeNum

Start of Pay Week

Total Punched Hours

Total Breaks

Total Work Hours

Non_overtime

Overtime

1640

3/19/2017

42.11666667

1.5

40.62

40

0.62

4218

3/19/2017

51.46666667

2

49.47

40

9.47

IFOBJECT_ID('dbo.ZTable1','U') ISNOTNULL

   DROPTABLE dbo.ZTable1;

GO

CREATETABLE dbo.ZTable1( [EmployeeNum]  Numeric(5,0), [TimeIn]datetime, [TimeOut]datetime, [PayCode]Numeric (1,0),[LBreak] Numeric (3,2));

INSERTINTO dbo.ZTable1([EmployeeNum],[TimeIn],[TimeOut],[PayCode],[LBreak])SELECT 1640,'2017/03/06 06:00','2017/03/06 14:32',9,.50                                                  

INSERTINTO dbo.ZTable1([EmployeeNum],[TimeIn],[TimeOut],[PayCode],[LBreak])SELECT 1640,'2017/03/07 05:59','2017/03/07 14:31',9,.50                                                  

INSERTINTO dbo.ZTable1([EmployeeNum],[TimeIn],[TimeOut],[PayCode],[LBreak])SELECT 1640,'2017/03/08 05:59','2017/03/08 14:30',9,.50                                                  

INSERTINTO dbo.ZTable1([EmployeeNum],[TimeIn],[TimeOut],[PayCode],[LBreak])SELECT 1640,'2017/03/09 05:59','2017/03/09 14:31',9,.50         --< Thursday                                   

INSERTINTO dbo.ZTable1([EmployeeNum],[TimeIn],[TimeOut],[PayCode],[LBreak])SELECT 1640,'2017/03/10 05:59','2017/03/10 14:31',9,.50                                                  

INSERTINTO dbo.ZTable1([EmployeeNum],[TimeIn],[TimeOut],[PayCode],[LBreak])SELECT 1640,'2017/03/20 06:01','2017/03/20 14:31',9,.50                                                  

INSERTINTO dbo.ZTable1([EmployeeNum],[TimeIn],[TimeOut],[PayCode],[LBreak])SELECT 1640,'2017/03/21 06:01','2017/03/21 14:33',9,.50                                                  

INSERTINTO dbo.ZTable1([EmployeeNum],[TimeIn],[TimeOut],[PayCode],[LBreak])SELECT 1640,'2017/03/22 05:59','2017/03/22 14:33',9,.50                                                  

INSERTINTO dbo.ZTable1([EmployeeNum],[TimeIn],[TimeOut],[PayCode],[LBreak])SELECT 1640,'2017/03/23 05:59','2017/03/23 14:30',2,0             --< Thursday                                        

INSERTINTO dbo.ZTable1([EmployeeNum],[TimeIn],[TimeOut],[PayCode],[LBreak])SELECT 1640,'2017/03/24 09:00','2017/03/24 17:00',2,0                                                    

INSERTINTO dbo.ZTable1([EmployeeNum],[TimeIn],[TimeOut],[PayCode],[LBreak])SELECT 1640,'2017/03/27 06:00','2017/03/27 14:32',9,.50                                                  

INSERTINTO dbo.ZTable1([EmployeeNum],[TimeIn],[TimeOut],[PayCode],[LBreak])SELECT 1640,'2017/03/28 06:00','2017/03/28 14:34',9,.50                                                                             

INSERTINTO dbo.ZTable1([EmployeeNum],[TimeIn],[TimeOut],[PayCode],[LBreak])SELECT 4218,'2017/03/06 06:12','2017/03/06 14:50',9,.50                                                  

INSERTINTO dbo.ZTable1([EmployeeNum],[TimeIn],[TimeOut],[PayCode],[LBreak])SELECT 4218,'2017/03/07 05:11','2017/03/07 15:46',9,.50                                                  

INSERTINTO dbo.ZTable1([EmployeeNum],[TimeIn],[TimeOut],[PayCode],[LBreak])SELECT 4218,'2017/03/08 06:12','2017/03/08 14:50',9,.50                                                  

INSERTINTO dbo.ZTable1([EmployeeNum],[TimeIn],[TimeOut],[PayCode],[LBreak])SELECT 4218,'2017/03/09 07:12','2017/03/09 14:54',9,.50         --< Thursday                                   

INSERTINTO dbo.ZTable1([EmployeeNum],[TimeIn],[TimeOut],[PayCode],[LBreak])SELECT 4218,'2017/03/10 07:12','2017/03/10 14:52',9,.50                                                  

INSERTINTO dbo.ZTable1([EmployeeNum],[TimeIn],[TimeOut],[PayCode],[LBreak])SELECT 4218,'2017/03/20 06:12','2017/03/20 15:49',9,.50                                                  

INSERTINTO dbo.ZTable1([EmployeeNum],[TimeIn],[TimeOut],[PayCode],[LBreak])SELECT 4218,'2017/03/21 07:13','2017/03/21 15:49',9,.50                                                  

INSERTINTO dbo.ZTable1([EmployeeNum],[TimeIn],[TimeOut],[PayCode],[LBreak])SELECT 4218,'2017/03/22 06:13','2017/03/22 15:51',9,.50                                                  

INSERTINTO dbo.ZTable1([EmployeeNum],[TimeIn],[TimeOut],[PayCode],[LBreak])SELECT 4218,'2017/03/23 07:12','2017/03/23 10:08',2,0                  --< Thursday                            

INSERTINTO dbo.ZTable1([EmployeeNum],[TimeIn],[TimeOut],[PayCode],[LBreak])SELECT 4218,'2017/03/23 05:00','2017/03/23 15:01',9,0                  --< Thursday                            

INSERTINTO dbo.ZTable1([EmployeeNum],[TimeIn],[TimeOut],[PayCode],[LBreak])SELECT 4218,'2017/03/24 05:10','2017/03/24 15:50',9,.50                                                  

INSERTINTO dbo.ZTable1([EmployeeNum],[TimeIn],[TimeOut],[PayCode],[LBreak])SELECT 4218,'2017/03/27 06:11','2017/03/27 15:48',9,.50                                                  

INSERTINTO dbo.ZTable1([EmployeeNum],[TimeIn],[TimeOut],[PayCode],[LBreak])SELECT 4218,'2017/03/28 06:16','2017/03/28 15:45',9,.50                                                  

GO

SELECT

   [EmployeeNum]

      ,CONVERT(DATE,DATEADD(week,datepart(week,[TimeIn])- 1, DATEADD(DAY,@@datefirst- DATEPART(weekday,CAST(YEAR(GETDATE())ASVARCHAR)+'-01-01')- 6, CAST(YEAR(GETDATE())ASVARCHAR)+'-01-01')))as'Start of Pay Week'

   ,sum(DateDiff(second,[TimeIn],[TimeOut])/60.0/60.0)as'Total Punched Hours'

   ,sum([LBreak])as'Total Breaks'

      ,sum(DateDiff(second,[TimeIn],[TimeOut])/60.0/60.0)-sum([LBreak])as'Total Work Hours'

      ,case whensum(DateDiff(second,[TimeIn],[TimeOut])/60.0/60.0)-sum([LBreak])<= 40 then sum(DateDiff(second,[TimeIn],[TimeOut])/60.0/60.0)-sum([LBreak])else 40 end as Non_overtime

      ,case whensum(DateDiff(second,[TimeIn],[TimeOut])/60.0/60.0)-sum([LBreak]) > 40 thensum(DateDiff(second,[TimeIn],[TimeOut])/60.0/60.0)- 40 - sum([LBreak])else  0 endas Overtime

FROM dbo.ZTable1

GROUPby [EmployeeNum],datepart(week,[TimeIn])

HAVINGsum(DateDiff(second,[TimeIn],[TimeOut])/60.0/60.0)-sum([LBreak]) > 40

ORDERby  [EmployeeNum],datepart(week,[TimeIn])

 

Error on WSUS installation, cannot identify SQL Server instances

$
0
0

Hi all, 

I have deploy a windows server 2016 with fully new provisioning, i have a SCCM Server which need to deploy software updating point on which i need to deploy a WSUS server. The WSUS is not deployed on the SCCM server because i dont have enough harddisk space to install it. Apparently, im installing the WSUS in a new server and when come to the input the database instances, i try to input my SCCM server name and the database instance name. I found the DB instance ID from the database configuration manager, eventually it seems like the installation is not detecting my SQL database instance path. 

Im experience this error:  (A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 25 - Connection string is not valid)

Link: https://www.photo-pick.com/online/lGEp.link

After the error appears, i have run some network test on the server and everything is fine. Can someone enlighten me for this issue?

Thank You



Help with TDS Protocol

$
0
0
Could anyone help me please with a TDS protocol? as I am new to it? I am trying to connect to MS-SQL using a TCP socket and sending the pre-login and the login for TDS as bytes, however so far my efforts to login are unsuccessful, as I kept getting login for user 'sa' failed, despite submitting the correct password. Thank you

SQLServer 2016 SSL error

$
0
0

SQL Server is not enabled for SSL communication. While the powerbuilder application connects to SQL server connections are not happening because of SSL error!

OS windows 2016 

SQL 2016

Client Windows 10

What is the default TLS version  used by 2016?

 

Pointers On Connecting to SQL Server 2016 via JDBC from Linux via Active Directory

$
0
0

I'm working with a client that has a need to connect to a SQL Server 2016 database from a Java application running on Linux.  They need to authenticate through Active Directory.  I'm struggling to find an example of a JDBC connect string that shows the proper syntax to connect to SQL Server via JDBC from a Linux-based Java application.  Also, I'm struggling to find clear documentation on whether or not anything in addition to the JDBC jar file is required on the Linux server.

Can anyone provide an example JDBC connect string syntax (anonymized, of course) that can be used in this type of set up?

Is there anything additional that is needed on the Linux server other than the JDBC jar?

I do not have an Active Directory configuration that I can test with, and I don't want to do a bunch of trial and error trying to figure it out in front of my client.

I've looked at several documentation articles in the Microsoft documentation, but I haven't found anything that answers my question.

Any help is appreciated.

Connection String OLEDBSQL Using Trusted Connection

$
0
0
I'm trying to switch my MSOLEDBSQLB connection string to support older ADO Recordset & MS DataShape connections to use TRUSTED style connection string and not able too. I have SQL native client trusted connection working for my .NET Connection. But need it to work for OLEDBSQL. By the way I installed the latest OLE DB Driver as well. That is why it added another version "MSOLEDBSQL.1" reference to provider.

Note this connection string is working in .net application on same app server connection string for sql native ver. 10 so I'm assuming permissions working (Server=DBSERVER1;Database=MyDB;Trusted_Connection=True;)

This connection works! Note this is a Windows Server/SQL Server 2019. So the Provider is referencing the latest working MSOLEDBSQLBdriver.

WORKS if using SQL Credentials

Data Provider=MSOLEDBSQL.1;DataTypeCompatibility=80;Provider=MSDataShape;Data Source=DBSERVER1;Database=MyDB;MARS Connection=True;MarsConn=Yes;User Id=myDBSQLUser;Password=#########;"

DOES NOT WORK using Trusted

Provider=MSOLEDBSQL.1;SERVER=DBSERVER1;Database=MyDB;Integrated Security=SSPI; Provider=MSOLEDBSQL.1;SERVER=DBSERVER1;Database=MyDB;Trusted_Connection=yes;

Result..

Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'.

I've seen it's supported in the MS docs, just can't get it to work. I also have my application using Impersonate=true.

Login from untrusted domain

$
0
0

Hello,

My SQL server is on domain A and my application (ASP .Net) is on domain B. When I am trying to access the database using SQL server authentication it works. However when I am trying to do windows authentication, I am getting error "Login failed. The login is from an untrusted domain and cannot be used with windows authentication". 

How can I make it to work with Windows authentication?

Thanks.

Not able to Create ODBC DSN using Microsoft OLE DB Driver for SQL server(msoledbsql.dll)

$
0
0

I have Microsoft OLE DB Driver for SQL server installed in my system (Windows 2019 server), version- 18.2.2.0.

Also, I can see a dll available at this location "C:\Windows\SysWOW64\msoledbsql.dll". Along with it, the below folder structures also got created:

C:\Program Files\Microsoft SQL Server\Client SDK\OLEDB\182

Now my question is,I was trying to create ODBC DSN using Microsoft OLE DB Driver for SQL server but, I am not sure which driver I need to select. Below is the list of the drivers available in ODBC Data Source Administrator(64-bit) and ODBC Data Source Administrator(32-bit):

ODBC Data Source Administrator(64-bit):

SQL Server

ODBC Data Source Administrator(32-bit):

1. Driver da Microsoft para arquivos texto (*.txt; *.csv)

2. Driver do Microsoft Access(*.mdb)

3. Driver do Microsoft dBase(*.dbf)

4. Driver do Microsoft Excel(*.xls)

5. Driver do Microsoft Paradox(*.db)

6. Microsoft Access Driver(*.mdb)

7. Microsoft Access- Treiber(*.mdb)

8. Microsoft dBase Driver(*.dbf)

9. Microsoft dBase- Treiber(*.dbf)

10.Microsoft Excel Driver(*.xls)

11.Microsoft Excel-Treiber(*.xls)

12.Microsoft ODBC for Oracle

13.Microsoft Paradox Driver(*.db)

14.Microsoft Paradox-Treiber(*.db)

15.Microsoft Text Driver(*.txt; *.csv)

16.Microsoft Text-Treiber(*.txt; *.csv)

17.SQL Server

It would be very helpful if anyone can please help me out in this. Thanks in advance.




How to eliminate non-english characters using SQL query?

$
0
0


Used the below query but not working.

select * from table where column not like '%[A-Z]%'

Getting error 18456 State 6 trying to setup linked server

$
0
0

Hi all,

I'm trying to setup a linked server and I get either

Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON'. (Microsoft SQL Server, Error: 18456) State 5

when I use login's current security context

OR

Login failed for user ****  (Microsoft SQL Server, Error: 18456) State 6

When I supply a remote login

Both servers are in mixed mode authentication, I'm sysadmin on both servers.

I have setup 2 other linked servers with no problem, which have the same configuration ?

What I'm I missing ? 

Thanks in advance

Rbie

ODBC all of a sudden not working - Invalid cursor state

$
0
0

Hi all,

been using a SQL Server R17 for 2 years now, and using Microsoft Access 64-bit to access data via passthrough queries and export to Excel.

All of a sudden I get the error 

ODBC--call failed

[Microsoft][ODBC Driver Manager] Invalid cursor state (#0)

I usually do just a SELECT * FROM TABLE.

I get this error just doing a SELECT @@VERSION in a passthrough query, so no complex stored procedures or anything like that. I tried using SQL Native Client 11, SQL Server , or ODBC for SQL Server 17 and all return the same error.

Everything works using SQL Server Management Studio 18.

Can you please help me?


How to transfer tables from one server to another in different domain using BCP

$
0
0

Hi,

I need to transfer few tables of database to another server DB which is in another domain. Can i perform it using BCP. Please let me know the script for it.

SSMS Error 64

$
0
0

I recently encrypted my hard drive using BitLocker, and now SSMS (as well as a C# Visual Studio project that I have connected to a database) displays an error when I try to connect to my local server with my desktop name. 

Any help would be appreciated

Database malformed

$
0
0

I have been trying to open my sql database and it's giving an error saying: database image is malformed

please help me

Excel Wont Refresh SQL Data

$
0
0

Hello All,

I have a user getting an error in Excel when connecting to the SQL server and trying to refresh data. I have looked online multiple times, but I have been unable to resolve with what I've found. I think it may have something to do with a self signed cert, but no one else that uses this connection is getting this error. User goes to the "Data" tab in Excel and hits "Refresh All". Will include screen shots of the error that proceeds. 


intermittent ODBC errors

$
0
0
intermittent [Microsoft][ODBC Driver 17 for SQL Server]Encryption not supported on the client.

Windows 2012R2 (IIS) talking to SQL Server 2012, Windows Server 2012R2

thanks
Viewing all 4164 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>