Need unique number for groups of records
Hi,I'm trying to do the following and haven't been able to figure it out.Say there's a table with these records:Col1 Col2 Col3a b ca b ca b de f ge f gI want to generate a number that represents the...
View ArticleUser Defined Function - using table name as variable
Hello everyone-I'm trying to create a simple function that will do a count on a table. I want to pass the table name in form of a parameter to the variable and this function will return the count as an...
View ArticleT-SQL QUERY - NOT ABLE TO PASS VALUE TO A VARIABLE
Hello Everyone-I've the below query where I am referencing an employee table that has the following structure and has three employee recordsID FIRST_NAME EMAIL_ADDR123 DONALD DONALD@GMAIL.COM345 MAYANK...
View ArticlePassing multiple columns values from SQL query to one variable
Hello everyone- Is it possible to assign multiple columns from a SQL query to one variable. In the below query I have different variable (email, fname, month_last_taken) from same query being assigned...
View ArticleDatabase Diagram
[font="Comic Sans MS"]Hi, I've been tasked to create a database diagram, save it and send that db diagram to the user. Now, I am confused as I don't know where sql server stores the db diagram...what...
View ArticleInline syntax for indexes
I wonder whether there's documentation about inline syntax for indexes for SQL Server 2014? I couldn't find it...
View ArticleSQL book for a beginner? -need suggestions
I'm going through Access 2010 Inside/Out, and only found out recently about SQL Express 2014. So I installed it on my computer. I looked into SQL many years ago, but that was before Microsoft had a...
View ArticleCombine data from historical table
Recently, I partitioned one of my largest tables into multiple monthly field groups. For the current month, it is attached to my "Active' table. The older records are kept in the "historical" table. I...
View ArticleTakes 5 Seconds to load values
Is there a different way I could do a query like this:SELECT ID FROM PropertiesFreeholdAndCondos WHERE lattlongchecked = 1 AND Latitude IS NOT NULL AND Longitude IS NOT NULL AND (...
View ArticleSending email from store proc
I have a store proc that generates a list of individuals who need to get an email along with the subject and body of the email that each person should get. How do I step through the list from the...
View ArticlePoor T-SQL code runs for over 10 hours !!! Help appreciated....
I am new to SQL Server and know next to nothing about T-SQL, although I do know a bit about SQL. Our purchasing department got a database package and some customised T-SQL from an external company and...
View Articlecolumnstore index issue
This result should tell you: Query Rows Time of execution w/o compression with compression with Columnar Indexes select * from warehouse.[dbo].[Timekeeper_Matter_Time_Summary_Period] 1,102,894 69 371...
View ArticleCTE
Input:Deptno Empname 10 Niladri 20 Jeeva 30 Deepak 30 Prantik 20 Arina Output:Deptno Empname 10 Niladri 20 Jeeva,Arina 30 Deepak,PrantikI have used CTE for thisWITH cteReports(Deptno,Empname) AS (...
View ArticleSpindle scripting tool - free addin for SSMS 2008, 2008R2, 2012, 2014
Hi all!We are very glad to present our solution in scripting area.[url=http://rockelk.com/spindle/ssms/]Spindle Scripting Tools[/url] - free addin for Sql Server Managment Studio.Feature list:- Getting...
View ArticleHierarchial Query
Dear allFollowing is my db tablestudent_id student_code student_parent_id student_name 1 11 0 a 2 111 1 b 3 1111 2 c 4 11111 3 d Can anyone here please help me to generate following op?student_id...
View Article2 tables combined left join to primary key of a 3 third table
Hi AllLooking to improve performance of the following code.It basically generates future days for each dog. So there is a dog table and a day table with every day.These 2 table cross join and then fill...
View ArticleSelect Parent and Child with HiearchyID
All,How to select parent and child with HierarchyID base on child attribute. Here's my table :[code="sql"]CREATE TABLE #BOMTbl( ItemNo HIERARCHYID NOT NULL, Lvl AS ItemNo.GetLevel() PERSISTED, MatID...
View ArticleLock Escalation in Sql Server 2014
Hi ExpertsI got a Sql server database 2005. Now I am in a plan to upgrade to 2014.In the 2005 database I have one monster generic table. Which is being used by entire application. The application sends...
View Articlerss.exe and sp_xpcmdshell
Hello community,Used Version: SQL Server 2014I try to execute a rs.exe command within a StoredProc per sp_xpcmdshelland get the following error message which comes from missing permissions. SELECT...
View ArticleSQLPlan query_plan_hash / query_hash do not match sys.dm_exec_query_stats ??
Altough I get to see equal values from both sources for the columns query_plan_hash and query_hash , the query does not evaluate them as being equal !Microsoft SQL Server 2014 - 12.0.2402.0 (X64) Aug...
View Article