Indexes - Behaviour on UPDATES
I would like to know what happens in the sense of performance when a non-indexed column in a table is updated. Is there any need to drop the indexes first to UPDATE that non-indexed column and then...
View ArticleOpenXML and Cross Apply Query Help !
Folks:I need help with XML query. I have this XML data and I'm using OPENXML to shred the data into table. For each ModelValue (/DataOutputEntries/ARun/SecXml/Sec/SRateArr/SRateArrValues/ModelValue)...
View ArticleDate Issue
Hi, I have the following output in a table: UID FID nDate ----------------------------------- 178 100 2013-06-03 16:12:23.000 178 99 2013-05-30 07:30:41.000...
View ArticleHow to display a multi-level hierarchy?
I have two tables: EmployeeMaster and EmployeeDetails. The schema of both are as below: Sample data in both tables can be seen via these links. Because of the restriction of uploading only two images,...
View ArticleHOW TO INSERT VALUES INTO A IDENTITY COLUMN
HI All,i have a only one ID column in a tableDDL:CREATE TABLE TEST_IDENT ( ID INT IDENTITY )Now i want to insert 1000 rows at a time:bala krishna
View ArticleHow To: Add an IDENTITY column to This View?
Hi,How to add an identity column to this view:CREATE VIEW [dbo].[MainStatistics] AS SELECT (SELECT COUNT(*) AS EXPR1 FROM dbo.Courses) AS CoursestCount, (SELECT COUNT(*) AS EXPR1 FROM dbo.Certificates)...
View ArticleAverage column
Good Morning,I am wondering how I can add a column to this SQL script that will calculate the AVG(PROC_TIME).If the PROC_NUMBER IS >= 10 Then the AVG should be grouped on MD_CODE,...
View ArticleJoin query question
This is an example. I have this below query. Is the last two joins valid ?"and d.org_key = b.system_id and d.category_key = c.category_key". Can I cross refer join.Select * fromAjoin Bon a.rep_id =...
View Articledefault data_compression
what is default data copression type for sql 2008 R2. Can we identify it?Best Luck, Shenoy
View Articlehow to declare a variable similar to table column type?
hi all,currently, i declare variable in stored procedure similar to db table column. is it a way to declare it like below:x_order_noso.order_no%type;i need to do it so that i dont need to change the...
View ArticleQUOTED_IDENTIFIER
How can I identify whether the QUOTED_IDENTIFIER is ON/OFF?Best Luck, Shenoy
View ArticleSuggestion for good T-SQL code formatting rules and tools
Dear collegues, I am struggeling with finding a good standard for our T-SQL code layout and indentation. Also, I would like to introduce a tool at our company that does the code layout for you. I have...
View ArticleNEED A QUERY
I need help on below query. Consider the Student table mentioned below Student NameMarksGradeBrad92 Spence73 Todd52 Jesse48 Generate/Fill the Grade column based on the grade table given below. Case...
View Articlehow to loop record in stored procedure
hi all,i am newbie in sql server. i have a scenario as below:1. i have new pricing table for all the products2. i need to update sales order details table where sales order created 3 days backhow do i...
View ArticleDo I need to INCLUDE the primary key in an index or not?
Dear collegues,The INCLUDE syntax in indexes is new to me. If I understand the online help correctly, every index will automatically include the clustered index. So if I have a table with a foreign key...
View ArticleWith CTE, how do i get a list of parents
I can figure out how to get children from a cte, but can't figure how to get parents.Here is sample code: declare @Forums table (IDINT, NameNVARCHAR(50), ParentINT ) INSERT INTO @Forums SELECT 1,...
View Article70-461 Update Functions
HiI'm going through 70-461 exam guide that I created a while ago http://www.katieandemil.com/exam-70-461-querying-microsoft-sql-server-2012-pdf-vce-ebook-free and try to fill in gaps.One of them is...
View Article