|
|
|
|
|
|
|
Question of the Day |
Today's question (by Steve Jones - SSC Editor): | |
Getting the Options | |
What is returned by @@OPTIONS? | |
Think you know the answer? Click here, and find out if you are right. |
Yesterday's Question of the Day (by Steve Jones - SSC Editor) |
Making a DataFrame I have two lists in Python: >>> a ['Ford', 'Chevrolet', 'BMW', 'Audi', 'GMC', 'Porsche', 'Toyota', 'Honda'] >>> b ['F150', 'Suburban', 'X5', 'Q5', 'Tahoe', 'Cayenne', 'RAV4', 'CRV'] I want to combine these in a dataframe, with the columns for make and model labeled correctly. Which of these will do this? Answer: df = pd.DataFrame({'Make':a, 'Model':b}) Explanation: There are multiple ways to do this, but the Pandas method, DataFrame, will allow you to put two lists together. When you want the column names, we send in a dictionary with the column name and list as a dictionary. Ref: Intro to Data Structures - https://pandas.pydata.org/pandas-docs/stable/getting_started/dsintro.html |
Featured Script |
thedspaincrew from SQLServerCentral A script to drive SQL Compare for building upgrade scripts.
|
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 - Administration |
Need connect string to connect from Linux to SQL Server using an A/D group name - ISO way to setup a connection string to connect from Linux to SQL Server using an A/D group name. (we do NOT want to use a SQL Login!) - this link details the setup for a Linux connection to a SQL Server database: https://github.com/mkleehammer/pyodbc/wiki/Connecting-to-SQL-Server-from-Linux - one of the final instructions during setup is to add […] |
SQL Server 2017 - Development |
How to split time into hourly slot using SQL (can use view,or stored proc or fun - I have data in table which has start date, end date and duration. I want to show hourly time slot. **logic**: - Condition 1. If start date =9:00 and end date = 11:00 then show the date as 09:00-10:00 10:00-11:00 It should repeat 2 times and all related column data will also repeat 2 times. […] |
SQL Server 2016 - Administration |
SQL Cluster - I am looking at a Cluster that has been built by a person that during the SQL Cluster installation he did not select all CSV's that related to the instance. This has meant that the storage fails over independently which is not ideal. there has been a case that two of the required volumes were […] |
Admin puzzler - ok so Friday off I get a call from user doing posting taking over an hour( should take 5 minutes). No blocking do deadlock no high CPU. Active sessions show higher reads than normal. No open trans. Go to mgmt. studio and when I try to open objects on main pharmacy database it times out. […] |
SQL Server 2016 - Development and T-SQL |
Using @@ROWCOUNT To Return Second Recordset in Sproc - I'm working with a Stored Procedure that hopefully will return two recordsets to a Classic ASP application. Currently, when I test my Stored Procedure, @@ROWCOUNT always returns the count of 1, even when the count is not 1. Here is my code for the Stored Procedure (below). Would I need to return the @row variable […] |
Problem to Display Field With OPENXML - Hello community, I am trying to Importing and Processing data from XML files into SQL Server tables, following the example post on this site : https://www.mssqltips.com/sqlservertip/2899/importing-and-processing-data-from-xml-files-into-sql-server-tables/ by Arshad Ali. This is the first time i use this technique, then i put only one filed to display, but i dont know why the result is always […] |
Administration - SQL Server 2014 |
Auto Shrink on live DB - Hello, On one of our customers' live server there are both live and UAT DBs. The latter occasionally replicated from the live DB upon customer's request. All has been done and maintained by DBA's. When such a copy generated I am normally required to truncate several of our biggest tables (some over 100 MBs), which […] |
SQL Server 2005 Installation After 2014 as Default Instance on Win Server 2012 - Greetings! Did anyone notice the anomaly as in below screenshot? When tried to install SQL Server 2005(bare version 9.0 - No SP) after SQL Server 2014(version 12.0) is already installed, the SQL 2005 threw error showing SQL 2014 installation as SQL 2000. OS : Windows Server 2012 X64 SQL Server 2014: Developer X86 SQL Server […] |
Development - SQL Server 2014 |
Stored Procedure with Parameters in Excel - Long Run time - I have a stored procedure with two date variables, Start date, End date. If I run this in excel, it takes forever and eventually deadlocks. ALTER PROCEDURE [dbo].[lost_sales_v2] @SD datetime, @ED datetime If I take the variables out of the procedure name and embed a set date range in the query, it returns in less […] |
SQL 2012 - General |
Using Correlated Queries with OPENQUERY - Good day everyone, I'm new to this forum and was hoping I could get some help with what I'm trying to accomplish. I'm trying to delete old users from each respective database from a list I have. Now I'm using SQL Server 2012 to do this, but the databases i'm connecting to are in […] |
SQL Server 2012 - T-SQL |
Index Size Question - I'm trying to track down storage usage on our SQL Server 2012 instance. I have a table with 11,703,018 rows and 10 indexes (9 non-clustered + PK) on it. The PK is a clustered uniqueidentifier (I know not the greatest but i'm stuck with it for now) that only has the uniqueidentifier column included (size […] |
Find time different based on Type by making group - I have data like attached picture, I want to make group each event when it starts from 1 and end till its max of eventId = 14 and calculate the time difference ... as shown in picture. If there are 8 EventType with 1 then it should have max of 8 eventType with EventType 14. […] |
SQL Server 2008 - General |
Unable to load text data in using BULK INsert with XML Format file - I have the following table IF OBJECT_ID('[TempDB]..[#LoadData]') IS NOT NULL DROP TABLE [dbo].[#LoadData]; CREATE TABLE [dbo].[#LoadData] ( [RTOPartyID] INT NULL , [Prefix] NVARCHAR(255) NULL , [FirstNames] NVARCHAR(255) NULL , [LastName] NVARCHAR(255) NULL , [Suffix] NVARCHAR(255) NULL , [PartyType] NVARCHAR(255) NULL , [PlaceOfBirth] NVARCHAR(255) NULL , [TaxIdentificationNumber] NVARCHAR(50) NULL , [CrownServant] BIT NULL , [DateOfBirth] […] |
Replication DB name - Hi, Supposing we would like to replicate a copy of a DB, called DB1 to another server. Does the database need to be called DB1 on the subscribers or does that not matter? |
Powershell |
Something akin to GROUP BY in SQL - So I have an array: $array = @() $Props = [ordered]@{Table="Table1"; Col1=1; Col2=2} $array += New-Object psobject -Property $Props $Props = [ordered]@{Table="Table2"; Col1=4; Col2=5} $array += New-Object psobject -Property $Props $Props = [ordered]@{Table="Table1"; Col1=3; Col2=7} $array += New-Object psobject -Property $Props $Props = [ordered]@{Table="Table2"; Col1=2; Col2=6} $array += New-Object psobject -Property $Props I want to […] |
| |
©2019 Redgate Software Ltd, Newnham House, Cambridge Business Park, Cambridge, CB4 0WZ, United Kingdom. All rights reserved. webmaster@sqlservercentral.com |