Quantcast
Channel: Microsoft SQL Server
Viewing all 4871 articles
Browse latest View live

SQL Server Code

$
0
0

Good day

I am struggling with writing a code to copy only charachters from columns that contains mixed data.

For example: 

Column1

558ABC9966

AB875XYZ

LMN94328

Is there a code that help me copy only the alphabetics from (Column1) so the result would be:

ABC

ABXYZ

LMN

Thank you in advance.

/Ibrahim


SQL Server 2016 and the need to restart after every install

$
0
0

Greeting guys,

Last week, we upgrade some server and start doing test with SQL server 2016, the goal here is to put all our SQL server 2014 into 2016. The way we are working, is every "big customer" haver their own instance of SQL server and we put all the small company in the same instance. So, every time we have a new customer, we install a new SQL instance.

In SQL 2014 we didn't have any problem with this, but now on SQL 2016, every time I install a new instance, a service pack or an update, I am force to restart. I can't make another install or update without restarting the server. And this is a production server, I can't restart the server every time we install a new customer. Every server restart is a loss of work for all our customer.

So here the question, do you guys know any way of installing SQL Server 2016 without the...

Convert currencyformat

$
0
0

I am running a SQL query that returns currency entries in the format of 21.0700. I need it to return the values in the format 00002107.  

best course for basic maintenance of SQL server?

$
0
0

After 20+ years of sysadmin work we will have a SQL server for the first time. Basically for a piece of CRM software.

So SQL 2017 was installed and the CRM software will be deployed.

My question... what is the best course (Microsoft M20764??) for learning the basics for maintaining such a server. no programming, no querying. Just backup/restore/export/import/datafile maintenance etc etc

thanks

Hans

Access Issue in SQL Server

$
0
0

Hi Team,

One one user getting below error while executing the SP from the database.

"The EXECUTE permission was denied on the object 'xp_logevent', database 'mssqlsystemresource', schema 'sys'

Login: AD Group name

Access granted to Login are:

DB_Owner On Master

Data reader, writer , all SQL Agent roles, SSIS Admin roles on MSDB database.

DB_Ower, execute role on user database where SP is exist,

Things I did from google are:

grant execute on xp_logevent to [domain\AD Group]

Added login group on Binn folder where Msssqlsystemresourse databases files exist and granted read/execute.

Executed in different ways:

Use master

Exec [FMG_EXO].[dbo].[FSG_LogEvent_FMGEXO] 'FMG_EXO_CreateSpreadsheet_Error_Check','E','FMGEXO_ERROR','7779','FMGEXO files are currently qued longer than the maximum time limit'

or

USE [FMG_EXO]

Exec [dbo].[FSG_LogEvent_FMGEXO] ...

SQL Linked Server to mirrored database

$
0
0

I'm trying to setup a linked server to a set of mirrored SQL databases, and am running into troubles. In the connection string, I've put:

SQL
SET@FriendlyName='Server'SET@ServerA='IP\INSTANCE'SET@ServerB='IP2\INSTANCE'SET@ProviderString='Server='+@ServerA+';FailoverPartner='+@ServerB+';Initial Catalog=master;'EXECmaster.dbo.sp_addlinkedserver@server=@FriendlyName,@srvproduct=N'SQLSERVER',@location=@ServerA,@provider=N'SQLNCLI',@provstr=@ProviderString,@catalog='MirroredDatabase'

The linked server works perfectly when server A is primary and B is mirror, but as soon as B becomes primary and A is mirror, I get login timeouts. I've tried with and without @Catalog, as well as setting the initial catalog to my mirrored database instead of master, but neither worked.

SQL
OLEDBprovider"SQLNCLI11"forlinked...

Azure SQL Server VM Windows Authentication: Unable to Connect

$
0
0

Hi all,

There is no lack of information available to resolve this issue, but I can't seem to make any of it work. I can connect to SQL Server using SSMS and SQL Server Authentication, but not Windows Authentication

Issue

When connecting with Windows Authentication "Cannot connect to 172.16.1.5. The target principal name is incorrect. Cannot generate SSPI context." Nothing appears in the SQL Server log.

Environment/Configuration

O365 Azure VM

Azure Joined Workstation

SQL Server Standard 2016 SP1, Default Instance

Windows & SQL Server Authentication enabled

Allow Remote Connections To This Server Enabled

Configuration ManagerProtocols for MSSQLSERVERTCP/IP - all enabled (IP1, IP2, IP3, IP4, IPALL) port 1433

Diagnostics

Kerberos Configuration Manager reports that "TCP must be enabled to use Kerberos Authentication on SQL Service 2016 Standard Edition...

Downgrade from SQL 2014 Express to SQL 2012 Standard

$
0
0

I will try to keep this simple and to the point. There are many parts so hang with me.

A software provider will be updating their software on our current server which will require SQL 2012 Express or newer to run. The software currently runs on SQL 2008 Express. When they do the upgrade they want to upgrade SQL 2008 Express to SQL 2014 Express so the upgrade is possible.

We will then be moving the program to a brand new server that will be running SQL 2012 Standard 64 bit. I found out that it was purchased with the old server but never put in place. I want to know if there will be an issue taking the database from SQL 2014 Express and having it run on SQL 2012 Standard or am I worrying over nothing.


substract four hours from current date time and get date

$
0
0

Hi,

How can subtract four hours from current date time and get date.

example current system date time is 2018-07-13 02:00 am then I need  date 2018-07-12 . four less 

system date time is  2018-07-13 04:00 am then date get  2018-07-13. like tat.

Replace Sql Server for Consumer Samples / Data

$
0
0

Currently we have a hosted SQL server with Rackspace. We use this to gather data from Consumers who request a sample of our product. 

This is fine for the DBA but does not show  information to Marketing without getting the DBA involved. After we get X amount of requests the DBA has SQL batch up and send the addresses as a CSV file to shipping to send out the samples. 

I was wondering if there were any services that could do this exact thing with possibly more security and a lot more access to Marketing and other members of IT. The main thing I don't know about would be if other services could batch up the requests and send them on a schedule. 

Thanks 

SQL Server Standard Per Core Licensing

$
0
0

Quick Question Regarding Per Core Licensing SQL Server Standard:

Hardware to be installed on is 16 core total available to the Hyper Visor.  4 Cores will be provided to Windows Server 2016 supplying SQL Services.  Does SQL Server Standard need to license all 16 cores? Even if it will never use more than 4 cores unless the time comes I upgrade another 2 core license?

If so I will probably need smaller servers instead of one larger server hosting all VM's:

only using 4 cores but paying almost 2000 x 8 for each x2 core license seems overkill for something I do not need. :-(

SQL Server 2012 out of space

$
0
0

Hi all, 

I have a problem with my database I am running out of space there are left 2 GB and all my database space is actually taking one table that is a report table for storing logs and etc I tried to delete rows before I delete them I gave 100GB more to the drive but after I run the command also this 100 GB now are full. If I shrink this mean that I have to build again the indexes and I don't want because the software that uses the database is not local so I do not want to get in deeper shit. Is there a way to regain again space ? All these problems are coming from one single table that I need the logs from the last 2 years and delete older than that. 

Update

$
0
0

Hello

Is it possible to update one column in the table without affecting the other columns?

I have a big table and some of it's columns had already data but when I updated one column from another table all the other columns data changed to Null value.

Listener does not connect to the correct instance.

$
0
0


Hi,

I have an instance with Always ON and two replicas, one of primary and one of secondary. I have created another instance and enabled Always On, each group located in different instances has a different listener with IP and different port. For the first case the listener works well, that is, it connects to the primary replica, and when the failover is done it behaves well. For the case of the second listener, I do not know why to try to connect through this, I am connecting to the group-instance of the first listener, someone has any ideas ??. For the second case, the replicas are fine, synchronized, the problem is that the listener does not connect where it should.

Thanks


SQL Query using multiple values

$
0
0

Hello

I'm trying to update a field in a table based on a condition that another field has a certain value:

UPDATE dbo. mydatabasetable SET myfieldname1  = 'XYZ' WHERE  myfieldname2= ('AA123','BB123','CC123','DD123');

I really don't know if I have the right formula, but it keeps saying 0 Rows affected but it should be updating myfieldname1 to 'XYZ' but it doesn't.

I'm no SQL expert and any advice would be greatly appreciated.

Thanks in advance


Best options for self learning SQL

$
0
0

Wanting to pick the brains of fellow Spiceheads... 

What tools/books have you utilized to teach yourself SQL or other options that you can recomend? 

I will be learning on MS Server 2016 and MS SQL 2014.

Thanks!

Ty

Query where column output is a link to web page

$
0
0

I am fairly new to SQL and have been doing weekly queries assigned by my boss so the dept can become more efficient in doing queries and learning SQL. This week's query has me stumped. We have to come up with a query where the output of one column is a link to the details page of that column.

i.e. Column labeled Parcel ID has a list of specific Parcel ID numbers. We have to have another column with a web page link to the details page of said Parcel ID.

So how can I come up with a query that would include the specific link to that web page. The query output will be copied and pasted onto excel, where in excel it has to be in a link format where when clicked will take you the specific web page.

My query so far has the Link column but that's to the general search page of said website. I need to be able to click on a link and for it to take...

DB migration from 2008 to 2016

$
0
0

We are planning to migrate SQL DB from 2008 server to 2016 server.

Anyone can help me with the right approach.

Thanks,

Amir

SQL Application issues

$
0
0

Hi all

I'm having a devil of a time trying to resolve an SQL application performance issue and run out of ideas.

The application is a local client install that talks to a SQL DB and also relies on a set of files on a network share.

In summary we had a an application upgrade to do, and at the same time we opted to move the SQL and application files from a local VM to a VM running in a datacentre as part of our MPLS network.

The problems are when using the application (a CRM) it hangs / pauses when switching between screens, waiting to open records, attaching external documents. It's not a consistent part of the application and there the problems are not consistent across individuals/devices/network connections etc.

Usual suspects rulled out as follows:

  • No difference running the application with Anti-Virus on / off (both client or server...

retrieve image through following query in ERP

$
0
0

Hello,

I am trying to retrieve image in one portlet through following script. My path is correct. I can see that image in browser using that path. However, that path is not working in a script. Do you have any idea about that? Please help me out for that. I am also sharing my script here.

Text
select distinct (''),nm.FIRST_NAME,nm.MIDDLE_NAME,nm.LAST_NAME,nm.EMAIL_ADDRESS from NAME_MASTER nm join TW_GRP_MEMBERSHIP gm on gm.ID_NUM=nm.ID_NUM join EMPL_MAST em on em.ID_NUM=nm.ID_NUM and em.ACT_INACT_STS='A' and (em.GRP_CDE not in ('WKST','WKSTF')) --and em.GRP_CDE in ('FAC','HRLY','INSTR','PROF','STAFF','SUPP') and (gm.GROUP_ID like 'staff' or gm.GROUP_ID like'faculty') order by nm.LAST_NAME, nm.FIRST_NAME 
Viewing all 4871 articles
Browse latest View live


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