to find equal and opposite rows in a table
How to find the equal and opposite rows in a table.E.g.:book positionA 500B -500C -500The output should return the rows having equal and opposite positions.O/P:A 500B -500I have tried self join on a...
View ArticleSelect data and count in view
Hello,How can I select data from a table and row counts from multiple tables in a viewfor example:Select * from Settings -- it gets 1 row onlySelect count(*) from NewApps where Status = 'False'Select...
View Articlemissing one record when selecting by date range
When I run this query:[quote]SELECT orderno, * FROM _order WHERE order_date >= '5/14/2015 00:00:00' AND order_date < '5/15/2015 11:59:59' ORDER BY order_date asc[/quote]I get a result...
View ArticleSql stored prcoedure help
Hi All, I have to modify a stored procedure that is written by someone else.Basically the stored prcoedure uses a cursor to fetch the data from the table and then insert that data in another table....
View ArticleSQL tables and rows counts PIVOT
Can anyone share if you have a script for finding row counts of two specific tables in each database of SQL in PIVOT format . e.g [b]Database || TableName1| Tablename2|| RowsCounts [/b]
View ArticleOdd 'Invalid object name' issue with temp tables
1. Run SQL Profiler with T-SQL and Errors and Warnings (Exception).2. Open a new query window in SSMS and run the following script (note the IF/DROP is not required to reproduce, just makes it easier...
View Articleinserting distinct values from one table to another table
Hi All, I have the following table[code]Table ACol1 0118F0118R56780118F0118R5678567856780118F0118R[/code]I want to insert only distinct values of Col1 from table A to another tableInsert into TableB (...
View Articlemultiple tables query
I have a basic level of t-ql, but can not get me pull this query results. Sorry by my bad englishSELECT pcm.CategoryId, pcm.ProductId, c.mlCode, mlc.codeFROM...
View ArticleCreating a table with Updatable columns and Read-only columns
Here is My requirement, I'm not sure if this is possible. Creating table called master like col1, col2 col3, col4 , col5 Where Col1, col2 are updatable - this can be done easily Col3, col4 are columns...
View ArticleUn-Group Data From Report
I wish I had more time to work on this but as usual everything needs to be done asap. This seems pretty tricky.Admittedly, I have not been the best about posting data per Jeff's very helpful Etiquette...
View ArticleSQL Server 2016 CTP - R?
Hi allHad a quick scan, but didn't see anything for 201(5)6 on here...Anyone figured out how the R in the CTP works? I can't find anything on it in the 2016 BOL or anything that looks like it in the...
View ArticleBest way to pull login data for auditing system wide?
I am trying to import this years worth of failed logins and last successful login for each user out of the logs using master.dbo.xp_readerrorlog. The script essentially loops through the linked servers...
View ArticleExcel frontend, SQL Server backend, triggers on views
Hi,SQL Server Express 2014Excel 2007A bit of preamble: I've been tasked to create a data entry application with Excel as the front end. (I think the FE should be Access, not Excel, but that's not my...
View ArticleInstead Of Triggers on Views
Hi,This post is related to http://www.sqlservercentral.com/Forums/Topic1690200-3412-1.aspx.Here is some standalone, sample code:[code="sql"]-- Create Fact TableDROP TABLE [dbo].[fact_Money]GOCREATE...
View ArticleTrying to learn SQL - Advice
Hey all,I am trying to learn how to use SQL and I have downloaded MSSQL Server 2014 Express. I am a complete beginner with little experience.I just downloaded and installed the Adventureworks DB to...
View ArticleStrange order of operations with columnstore index
I have a query that joins a dimension to a fact table. The fact table has a columnstore index on it. In my select clause I do a cast on a field from the dimension from a varchar to a date. One row in...
View ArticleSSIS in 2014 upgraded package question
On SQL Server 2008 R2 some SSIS packages created and regularly scheduled to run have worked perfectly for over a year. These packages have been upgraded on our new 2014 server ... now some fail with...
View ArticleWhy is this CTE so better solution then Cross Apply ?
Tables :CREATE TABLE [Production].[Products]( [productid] [int] IDENTITY(1,1) NOT NULL, [productname] [nvarchar](40) NOT NULL, [supplierid] [int] NOT NULL, [categoryid] [int] NOT NULL, [unitprice]...
View Articlesp_send_dbmail truncates when attaching query results.
Installed SQL Server 2014 CU1. While testing sp_send_dbmail I noticed the query results, when attached are cut off or truncated. Max file size has been 64k -65k. I set the max file size to 104857600...
View ArticleQuery assistance....
I really do appreciate anyone's willingness to give me direction. I need to select from a table that looks like this:[img]http://www.sqlservercentral.com/Forums/Attachment17308.aspx[/img]In this table,...
View Article