Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Browsing all 3145 articles
Browse latest View live

Changing the case of letters in SQL - update of rows

Hi thereI have a large table showing lists of world countries with some rows showing e.g. UNITED KINGDOM and some showing United Kingdom. I want to make all the countries appear in upper case letters,...

View Article


Select Number of Times a Product sold per minute

Hello Everyone,I am in need of some assistance with an odd type of query.  From the data listed below, I am stuck on how to count the number of times a product has sold  per minute of each day of the...

View Article


OpenRowSet - Bulk Load Performance Considerations

Hi,I have a scenario where I need to load a table using OpenRowSet - Bulk Load option.   The table is Clustered Indexed. There are no ROWS_PER_BATCH sort of hints currently being used.  The load file...

View Article

Cycle time based on assigned user from a single date field

Hi I have a requirement where I have to find the cycle time for each user that they have been assigned to the ticket. If you see the sample data, I need to get 67 days for JB user for the ticket...

View Article

Alternative to below query to replace while loop to get same output.

Hello Guys,I have 2 tables - one having the latest records (#Director table) and other table ( #DirectorAudit ) which has records where changes has taken place. The AuditId is the sequence of changes done

View Article


Is there a better way to write a simple query?

This is pretty typical SQL Code for me:[code language="sql"]

View Article

Top amount invoiced query help!

CREATE TABLE Test (    Name varchar(255),    InvDt varchar(255),  Typeflag integer,    amountI integer,    amountP integer);INSERT INTO Test (N

View Article

Execution Plan differences

I had to move some tables and procs to new DB. The proc that was working relatively faster (27 secs) in old DB now taking longer than 2 mins. I've attached execution plan from both DBs. Any help...

View Article


Stuck on getting Nulls to be 0's in my pivot

I read all of the posts on this site and can't figure out how to translate that information to my code.I found out real fast that I can't do ISNULL(XX,0) in my Select when I pivot.  Ideas?  Thanks Here...

View Article


Help using Dynamic SQL to query all columns in a table

Hi all,I am attempting to create a stored procedure that has the following requirements:1. The ability to pass it a table name2. Run the below on each column in the table:[code la

View Article

SQL HTML Outlook workflow formatting issue

Hi there,I'm hoping to get some help on an SQL, HTML, Outlook 2013 issue. I have a workflow in my sql database, when the value of the "Status" field is "Agree" then I want it to pull o

View Article

Multiple joins vs. 1 lookup table (alternatives)

Hi,In a DataMart analysis for a CRM system, about 10 Dim tables are joined with FactTable to see if the account is also in the table (inner join). This takes a long time (even with an index on KeyCol)...

View Article

Loop through resultset, update table and remove trailing and leading spaces.

I have a query which generates a SQL which I then copy and paste in a query window and execute. I am wondering if I can use loop so I don't have to copy and paste and execute all sql queries. but I...

View Article


Pulling Top XX rows, where XX is a percentage of records

it never stops around here. . . lolMy clients brings in between 20,000 and 30,000 SKUs a month.He wants me to audit 1% of them.  Literally, 1% each month. I currently use 25. How can i change this code...

View Article

Size taken by NULL

Hi Experts,We have a column with 136 columns and out of which 21 columns are NULL for the total 65000 rows. How to find the size taken by these columns which have nothing?

View Article


'Error: Invalid Custom SQL query. Permission was denied'

Hi, The sproc uses linked server to connect to a database. And it executes well on SSMS. However, on the front end, it is getting 'Error: Invalid Custom SQL query. Permission was denied.' Thanks in...

View Article

Select top issued, continued

Ok, now i need  to pull a specific number of entries from a table based on the following code. i can't figure out how to get the count from #Temp1 into the "X" on row one.Thoughts?[cod

View Article


Identifying field value corresponding to MAX of another field value

Hey All,I'm hoping to get your expertise on this. I'm trying to populate a temp table as part of a bigger query, and I need to identify the value for the AssetClassCode which has the corresponding...

View Article

Optimize Stored Procedure

Hello,I have this stored proc I am trying to determine if it can be optimized for better performance. Currently it takes 15 minutes to INSERT 28,000 records into [Email] table on a VM with multiple CPU...

View Article

SQL server profiler 2014 not showing text data in the bottom pane.

I have my sql server profiler 2014 setup. I am able to run the profiler successfully. I am able to see the queries in the top pane.When I select one or more rows in the profiler top pane, nothing is...

View Article
Browsing all 3145 articles
Browse latest View live