Quantcast
Channel: Forum Getting started with SQL Server
Viewing all 8709 articles
Browse latest View live

SQL Server Product Key

$
0
0

Hi, 

I've moved into a role to setup SQL Servers for our clients. For a long time, we've been using an ISO file to install located in one of our shared drives, instead of using the SQL DVD that come with the Server when we buy it. The ISO auto populates the product key, and we never changed it. I was under an assumption that it gets the SQL Key from windows somehow. I compared the auto populated key to the Key on the DVD and they are different. Is this violating the licensing terms?


SQL Server 2014 SP3 CU3 - Support Cycle?

$
0
0
I've been hunting for this but cannot seem to find the answer. When will SQL 2014 SP3 CU3 be out of support with Microsoft? And what are the implications of being "out of support" with Microsoft? Any help is much appreciated!

After I upgrade from Managment Studio 18.0 to 18.1, I have an error in my select statements

$
0
0

I am trying to call a table function and it is a query that executes several Selects with union, and it take 0 seconds. I run the function from Managment Studio 17.9.1 and it works perfect.

The error I have is : "The query has been canceled because the estimated cost of this query (28) exceeds the configured threshold of 3. Contact the system administrator.

Managment Studio 18 and 18.1 comes with a lot of bugs!!!

First with Managment Studio 18.1 was the problem of the Database Diagrams node missing, later when changing tabs the problem of accelerate hardware don't permit refresh the windows,  now queries don't run !!!


How to create batch file to create database

$
0
0

Hi All,

I want to write a batch script/ shell script to create a mysql database. My command looks like this :

CREATE DATABASE xxx
GO
CREATE LOGIN XXX
WITH PASSWORD ='XXX';
USE XXX;
EXEC sp_chagedbowner XXX
GO

while executing, it should ask Database name,user name, password , use. if these details are given then it should execute my script and give admin access to the login name in the DB.

please help !!

Thanks,

Nitu



Login with specific user name and password not working

$
0
0

Hi,

i am Trying to login to SQL, if i will put user id and password its not working but if i will login with same credentials on Windows and then use "windows Authentication" it works, even if i open SQL management studio with "other user and provide the credentials its working ? any idea

 

SQL 2019 CTP - Polybase External Table for DB2

$
0
0

Hi, I'm trying to create an external table in sql 2019 for DB2 by using the following code (tried different ways) but this fails, whether it's via the odbc driver or by using a DSN odbc for DB2.

CREATEMASTERKEYENCRYPTIONBYPASSWORD='Pass@word1';

GO

CREATEDATABASESCOPEDCREDENTIAL[DB2DB]

WITHIDENTITY='dbmon',SECRET='xxxxxxxx';

GO

CREATEEXTERNALDATASOURCE[DB2DBSource]

WITH(LOCATION='odbc://uedcb623.frmon.danet:60012',

CONNECTION_OPTIONS='Driver=IBM DB2 ODBC DRIVER;ServerNode=uedcb623.frmon.danet:60012;Database=CDSSNO01',

-- PUSHDOWN = ON | OFF,

CREDENTIAL=[DB2DB]);

GO

CREATEEXTERNALDATASOURCE[DB2DBSource2]

WITH(LOCATION='odbc://uedcb623.frmon.danet:60012',

CONNECTION_OPTIONS='Driver={IBM DB2 ODBC DRIVER - DB2COPY1};ServerNode=uedcb623.frmon.danet:60012;Database=CDSSNO01',

-- PUSHDOWN = ON | OFF,

CREDENTIAL=[DB2DB]);

GO

CREATEEXTERNALDATASOURCE[DB2DBSource3]

WITH(LOCATION='odbc://uedcb623.frmon.danet:60012',

CONNECTION_OPTIONS='DSN=DB2ODBC;Database=CDSSNO01',

-- PUSHDOWN = ON | OFF,

CREDENTIAL=[DB2DB]);

GO

CREATEEXTERNALTABLE[dbo].[W_SFA_TSK]

(STATUSVARCHAR(1),DFUVARCHAR(1),FLWORKVARCHAR(1),AUVARCHAR(8),MODIFIEDVARCHAR(8),PKEYVARCHAR(16),HKEYVARCHAR(64),BUSINESSMODIFIEDdatetime,BUSINESSAUVARCHAR(8),HOSTSOURCEVARCHAR(50),CLIENTVARCHAR(3),UIGROUPVARCHAR(50),IDVARCHAR(50),ACTIVEVARCHAR(1),SALESORGVARCHAR(4),SORTVARCHAR(5),METATYPEVARCHAR(3),SYSNUMBERPKEYVARCHAR(16),SYSNUMBERHKEYVARCHAR(64),LOCATIONTYPEVARCHAR(3),NOTEVARCHAR(1024),WIDTHDECIMAL(15,0),HEIGHTDECIMAL(15,0),PDASCANNERPOLICYVARCHAR(1),SCANREQUIREDVARCHAR(1),SURVEYREORGPERIODTYPEVARCHAR(15),SURVEYREORGMINREMAININGDECIMAL(9,0),SURVEYREORGOFFSETDECIMAL(9,0),BLINDMODEVARCHAR(1),SURVEYREORGMODEVARCHAR(10),SURVEYREORGMAXOFFSETDECIMAL(9,0),T_REC_UPD_TSTdatetimeNOTNULL)

WITH(LOCATION='CEDWCAS.W_SFA_TSK',DATA_SOURCE=[DB2DBSource]);

GO

And here's the not so helpful error message:

Msg 105082, Level 16, State 1, Line 24

105082 ; Erreur ODBC générique : [IBM][CLI Driver] SQL10007N Message "0" could not be retrieved.  Reason code: "6".

Additional error <2>: ErrorMsg: [IBM][CLI Driver] SQL10007N Message "0" could not be retrieved. Reason code: "6".

, SqlState: HY000, NativeError: -1042 .

while attaching .mdf file getting error " Cannot find server certificate with thumbprint '0xE4FFF*****CC'.

$
0
0

I am attaching to .mdf files of one instance to another but getting below error

 " Cannot find server certificate with thumbprint '0xE4FFF*****CC'.

looks like DB is in encrypted form, but now how can i remove encrypted details from .mdf file

please assist

How to ignore double or multiple spaces when finding duplicate data

$
0
0

I am trying to find duplicate data, including data with double or multiple spaces between the words that makes up the names. This is in SQL Server

Example:

Product Names in a Product Table:

Lime Cola

Lime Cola

Lime    Cola

This query will return just the first two, but not the third one:

SELECT * FROM [DBNmae].[dbo].[TableName] WHERE [productname] IN (SELECT [productname] FROM [DBName].[dbo].[TableName] GROUP BY [productname] HAVING COUNT(*) > 1)

How can I adjust the query to return all three?

That means, the double or multiple spaces within  "Lime    Cola" should be ignored.

Thanks,

Cypray


SQL Reporting Services Database Creation Error

$
0
0

Trying to create reporting database for integration with M-Files Reporting Module, I have never dealt with SQL at all before this.

I have installed SQL Express Advanced 2017, SQL Report Server Configuration Manager and SQL Management Studio.

I am trying to create a new Report Server Database but keep getting the below error, hoping someone can help out.

System.Data.SqlClient.SqlException (0x80131904): CREATE DATABASE permission denied in database 'master'.
   at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
   at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
   at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
   at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite)
   at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)
   at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
   at Microsoft.ReportingServices.Common.DBUtils.ApplyScript(SqlConnection conn, String script, ICommandWrapperFactory commandWrapper)
   at Microsoft.ReportingServices.Common.DBUtils.ApplyScript(String connectionString, String script)
   at ReportServicesConfigUI.SqlClientTools.SqlTools.ApplyScript(String connectionString, String script)
ClientConnectionId:cc0f3827-db22-4b53-b58d-6aa2b58888b9
Error Number:262,State:1,Class:14

How to delete a SQL Server local security group on Windows 10 Home?

$
0
0

Hello Everyone,

I am trying to uninstall Microsoft SQL Server from my machine. Uninstall instructions say one must delete all local security groups for SQL Server components before uninstalling, however I cannot figure how to do this on Windows 10 Home. I have found online two ways of doing this, but neither has worked.

The first way is through 'Control Panel > Administrative Tools > Computer Management > Local Users and Groups'. Because I have Home edition, the 'Local Users and Groups' option does not seem to be available so I cannot delete anything this way. Running MCM.exe and trying to add the respective snap-in doesn't work either (error says "This snap-in cannot be used with this edition of Windows...").

The second way is through PowerShell. If I use the cmdlet:

Get-LocalGroup

I can see a SQL Sever group called:

SQLServer2005SQLBrowserUser$<computername>
However, if I try to delete it using the cmdlet:
Remove-LocalGroup -Name "SQLServer2005SQLBrowserUser$<computername>"
I get an error message saying that no such group exists, as it cannot read what follow the dollar sign ($). Since -Name doesn't accept wildcards here, I don't know how to tell PowerShell to delete this group.

What am I doing wrong here? Is there anther way to do this?

Sorry if this is a newbie question, but I am currently at a loss and cannot find any other ideas how to do this.

Thank you.


PIVOT in query error

$
0
0

I'm using the following query and i am getting  "incorrect syntax near the keyword 'FOR'".

I'm trying to use a pivot to show the last cost of the item by location. Can anyone help me figure out what am I doing wrong?

Thank you!!

SELECT 
PV.ITEM_NO, [102],[104],[119]
FROM
(SELECT
IM.ITEM_NO,
IM.DESCR,
IV.LOC_ID,
IV.LST_COST
FROM
"company"."dbo"."IM_ITEM" AS IM
LEFT OUTER JOIN
"company"."dbo"."IM_INV" AS IV
ON
IM.ITEM_NO = IV.ITEM_NO) AS PV

PIVOT
(
PV.ITEM_NO FOR PV.LOC_ID IN
([102],[104],[119])) AS PVT

SQL SERVER

$
0
0
In SSMS when i click the new query the window opening slowly and if i want check anything on the server through GUI method it is opening slowly like buffering...How can i resolve this issue..?

How to update view columns for certain rows

$
0
0

Hi,

I have created an SQL Server view, which amongst other things, it generates the following columns:

CASE 
WHEN 
                        ...conditions...
THEN Main.[ExpenseCategory]
END [ExpenseCategories],

It generates the following view (an extract):

ExpenseIDPropertyShareHolderIDExpenseCategoryExpenseCategories
37237Property PurchaseNULL
37231156Property PurchaseNULL
37457Property PurchaseNULL
37451156Property PurchaseNULL
37497Property PurchaseProperty Purchase
37491156Property PurchaseNULL
38017Property PurchaseProperty Purchase
38011156Property PurchaseNULL
38227Property PurchaseProperty Purchase
38229Property PurchaseNULL
38221156Property PurchaseNULL
38237Property PurchaseProperty Purchase
38231156Property PurchaseNULL
38247Property PurchaseProperty Purchase
382418Property PurchaseNULL
38241156Property PurchaseNULL
38257Property PurchaseNULL
382512Property PurchaseNULL
38251156Property PurchaseProperty Purchase
38377Building Labour & MaterialBuilding Labour & Material
38371156Building Labour & MaterialNULL
38517Building Labour & MaterialBuilding Labour & Material
38511156Building Labour & MaterialNULL
38737Building Labour & MaterialBuilding Labour & Material
38731156Building Labour & MaterialNULL


As you will note, the "conditions" are satisfied for only one member of the ExpenseID group where ExpenseCategories is set to ExpenseCategory and for all others in the same group it is set to NULL.

How can I set ExpenseCategories to the same value for all members of the same ExpenseID group?

Thanks for your help in advance.

Regards

Abbas


Abbas


SSMS problem

$
0
0

Blue icon with question mark on SSMS..? what does it mean..! How can i resolve this issue..


I want to import .csv file into sql server and getting error. How we can resolve this error


i forgot my password

$
0
0
how to restore password or how to connect the sql database

DBCC CHECKDB Errors on Secondary Synchronized Replica

$
0
0

I have below specifications:

SQL Server 2014 SP2 GDR

Availability Groups (3 Replicas (2 Synchronized + 1 Asynchronized))

NOTE: Lastly we have enabled Encrypting File System to our File Stream DB containers on all the 3 AG Replicas.

I have regular DBCC Maintenance plan task scheduled in both Primary Synchronized Replica (A)and Secondary Synchronized replica (B). the task are scheduled in same time in both A & B Replicas every Sunday at 11:00 PM .

  1. On Primary Synchronized replica , the task completely successful with no errors reported

  1. On Secondary Synchronized replica , the task completed and with  errors reported

My Question :

  1. Why I am facing the corruption errors only in Secondary?
  2. Is it because I have scheduled them same time ? 
  3. Is it required to run DBCC CHECKDB on all the secondary replicas as well ?
  4. Mostly the issues are with filestream files , how to deal this case , please help.

Error Messages

Msg 2537, Level 16, State 0, Line 3 Table error: object ID 1822629536, index ID 1, partition ID 72057594068271104, alloc unit ID 72057594108706816 (type In-row data), page (1:3340563), row 5. The record check (valid computed column) failed. The values are 8 and 0.

Msg 2537, Level 16, State 0, Line 3 Table error: object ID 1822629536, index ID 1, partition ID 72057594068271104, alloc unit ID 72057594108706816 (type In-row data), page (1:3400558), row 26. The record check (valid computed column) failed. The values are 8 and 0.

Msg 8976, Level 16, State 1, Line 3 Table error: Object ID 1822629536, index ID 1, partition ID 72057594068271104, alloc unit ID 72057594108706816 (type In-row data). Page (1:1980236) was not seen in the scan although its parent (1:3008293) and previous (1:1980235) refer to it. Check any previous errors. DBCC results for 'AB.Table'. There are 755226 rows in 13575 pages for object "AB.Table". CHECKTABLE found 0 allocation errors and 15 consistency errors in table 'AB.Table' (object ID 1822629536). DBCC results for 'sys.filestream_tombstone_2073058421'. There are 7402 rows in 214 pages for object "sys.filestream_tombstone_2073058421". repair_allow_data_loss is the minimum repair level for the errors found by DBCC CHECKTABLE (DBName.AB.Table). DBCC execution completed. If DBCC printed error messages, contact your system aABinistrator.

Regards


Best Regards,SQLBoy


Mixing data in tables between enviroments

$
0
0

Hello,

Im running small enviroment using MSSQL 11.0 (2012).

I have my so to call it "production" database where I have a lot of tables with personal information such as Name, Last Name, phone number, email address, ip address, etc.

I would like to use this DB on lets call it "test" enviroment but I dont want this data to be somehow stolen at least in the way which it is on "production", thats why I would like to mix all information in this tables on "test" enviroment so for example person with <id1> <name1> <lastname1> <email1> will have <id1> <name2> <lastname34> <email992>.

Is there any way to mix data in this way?

I heard about dynamic data masking but in this case this dont solve my issue, as this only covers view of some data form users which dont have enough privileges to see it.

Machine Learning Services in MS SQL Server 2019

$
0
0

Hi Team,

Though I have followed the installation process as per the microsoft documents I am unable to install the services provided by Microsoft.For example Revoscalepy exists in the sitepackages but when I am importing the same module using jupyter notebook it throws me a error of module not found.

And when I re-install the SQL server deleting every log it creates a other mess like I am unable to open the jupyter notebook even.

So can you provide me with some solution so that I can follow to complete the installation.

Please treat this as priority

Any Query Tool for SQL Server data Read operation like SELECT

$
0
0


I need developer and analyst  to SELECT data for their analysis, However I do not want to give them access for server.

Can anyone advise to use any best Query Tool to just SELECT data from Production SQL Server and which should not harm production server performance.

Thank you

Viewing all 8709 articles
Browse latest View live