|
|
|
|
|
|
|
|
Question of the Day |
Today's question (by Steve Jones - SSC Editor): | |
Missing Data | |
I have this data in a text file:
Steve,DEN,LHR,5 Kendra,PDX,LHR,4 Grant,BOS,LHR, Steve,DEN,SYD,I have imported the numpy module as np and now want to read this data into an array using that module. However, I need values for the missing items in the last two rows. My code looks like this: >>> flight = np.genfromtxt('e:\\Documents\\flight.csv',delimiter=',',xxxx=7,dtype=("|S10","|S10","|S10",int))What parameter do I put in place of the xxxx to get the missing values to default to 7? | |
Think you know the answer? Click here, and find out if you are right. |
Yesterday's Question of the Day (by sergey.gigoyan) |
XACT_STATE() vs @@TRANCOUNT Let’s assume we have an empty table in the TesDB database with the following structure: USE TestDB GO CREATE TABLE TestTable ( ID INT PRIMARY KEY, Val INT ) GO In a new query window, we start the following transactions: USE TestDB GO BEGIN TRANSACTION INSERT INTO TestTable(ID, Val) VALUES(1, 100) BEGIN TRANSACTION SELECT XACT_STATE() AS 'XACT_STATE' SELECT @@TRANCOUNT AS '@@TRANCOUNT' INSERT INTO TestTable(ID, Val) VALUES(2, 200) COMMIT COMMIT What will be the selected values for the XACT_STATE and @@TRANCOUNT? Answer: XACT_STATE =1, @@TRANCOUNT =2 Explanation: XACT_STATE is the state of transactions for the current session. In this case, we have an active transaction, so this is 1. We have started two transactions, so @@TRANCOUNT will be 2. Ref:
|
Database Pros Who Need Your Help |
Here's a few of the new posts today on the forums. To see more, visit the forums. |
SQL Server 2017 - Development |
Update - W. Average Query - I need help with UPDATE Query. I have this data in tables and want to update weighted average in table tblData3 - (TValue * BPrice) .... / SUM(TValue) create table tblData1 ( IDate date, PID varchar(20), SID varchar(20), TValue float ) insert into tblData1 values ('10/15/2019','4567','ABC',4567.34) insert into tblData1 values ('10/15/2019','4567','ABC',5678.34) insert into tblData1 values […] |
SQL Server 2016 - Administration |
Suspended session - Hi, Application service is going to hung state and when we check the database, there is a connection in suspended state and it is running forever until we restart the service. And the wait event is ASYNC_NETWORK_IO. The query running is very small select query, fetching couple of hundred rows. and there is no information […] |
XP_send mail fail - We migrated from sql 2005 to sql 2016 recently in one of the job we are getting error Executed as user: ' 'Failed to initialize sqlcmd library with error number -2147467259. [SQLSTATE 42000] (Error 22050). The step failed. SQL agent has sysadmin and database reader role access on msdb how to solve the issue […] |
Minimum memory - Hi All , Should we adjust the minimum memory per query (in KB) in SQL ? The default is 1024 KB and I plan to change it into 2048 KB , Would it help boosting SQL performance ? Also if change it into 2048 KB , should I change Minimum server memory (in MB) into […] |
Monitor / Alert PII fields - Best 3rd party tool? - I have been tasked with finding a new tool for Database Activity Monitoring. We have previously used Mcafee DAM tool but that is ending and we are frantically searching for a replacement. If anyone has any experience recently with a 3rd party Data Monitoring / Activity Monitoring tool please let me know. Thanks […] |
Trigger store procedure with a file in SQL Server - Hi, Will receive a JSON file from an application on to D drive D:\tmp Whenever I receive that JSON file, a stored procedure has to execute taking that JSON file as input file? How do I automate it? |
Is it possible get from Query Store historical ~ CPU % usage by each query ? - Is it possible get from Query Store historical ~ CPU % usage by each query in 1 hr range? Many places share code where "avg cpu utilization " or max cpu utilization" extracted from query store (https://github.com/MicrosoftDocs/azure-docs/blob/master/articles/sql-database/sql-database-monitoring-with-dmvs.md) -- Top 15 CPU consuming queries by query hash -- note that a query hash can have many […] |
missing storage space - Hi I have a particular drive on one of my sql servers, it's gotten very full - there are no log files involved, this is purely data within the filegroup (primary) there are only 2 tables (everything else is in other filegroups) dtproperties sysdiagrams These are tiny - when I do a dbcc shrinkfile, I […] |
Administration - SQL Server 2014 |
How does DBCC CHECKDB use tempdb? - I would like to know the working principle of DBCC regarding the tempdb. I want to know why it uses tempdb for what purpose. I didn't find any advanced article about that so maybe someone can shortly explain or at least share links for the article about that. |
SQL 2012 - General |
Analysis services - I have disk space is getting filled up with Analysis OLAP and log location where it has extensions of .db Does it mean they are analysis services databases? I am planning to delete older dbs on analysis services do you see any issues? Please advise? |
SQL Server 2012 - T-SQL |
Need help with a Query - Hi, Below I have code that takes in 3 parameters. Now, sometimes, as you can imagine one of these can have a value, or only two, or all three may be populated. I am trying to find a way to write the code below so that this will work, but so far it has not. […] |
T-SQL (SS2K8) |
Running Totals by Date and Account - I'm trying to develop T-SQL (SQLServer 2008 R2) logic for calculating running totals for all accounts each day. The database columns available are Date, AccountNo and Amount. I need a report to list dates in the first column and each accounts running total in succeeding columns to the right. I would like all dates listed in column […] |
SQL Azure - Administration |
Does blocking has affect on High DTU utilization ? - Hi, Does blocking has affect on High DTU utilization ? (some people advocate that Spike in DTU might be caused by high number of blocking processes , or long term blocking) DTU definition select convert(decimal(18, 0),AVG([avg_DTU_percent])) from (SELECT (SELECT Max(v) FROM (VALUES (avg_cpu_percent), (avg_data_io_percent), (avg_log_write_percent)) AS value(v)) AS [avg_DTU_percent] FROM sys.dm_db_resource_stats WHERE end_time>=DATEADD(MINUTE, -10, GETUTCDATE())) […] |
Reporting Services |
SSRS Enterprise vs Standard Edition - I need to install SSRS for report development and deployment. I don't work with it myself and I haven't had much luck trying to find the information I need. My boss would like me to install SSRS 2019 Enterprise Edition. It looks like there is just one download for SSRS 2019. Here are the questions […] |
Integration Services |
Flat file source to destination table is getting only top 1 record into table - I have a package where i have flat file source with 4 columns and the source file will be in this format 123456|20130701|AWD|WS1035575|20170201|VCDF|MA1064844|20110001|NHS|AS19474754|20160401|EFV7|LK First column holds -123456 Second column holds -20130701 Third column holds -AWD Fourth column holds -WS it repeats …... before for each loop i have a script task where the files […] |
| |
©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved. webmaster@sqlservercentral.com |