Why we use with(nolock) in sql server with table?
Hi,I have seen many database, there are query like -select * from xyz WITH(NOLOCK)why this WITH(NOLOCK) required!!!Please suggest!!!Any Approach welcome!!
View ArticleStoring results of sp_helpmonitorhelpsubscription into a table?
Hi All,I am trying to create a query that will store the results of helpmonitorhelpsubscription into a table so I can use that for an SSRS report eventually, to show the current status of my...
View ArticleHow to get numeric data from a string using t-sql
Hi All,I have a table with 2 columns ID as Int and Message as nvarchar(max) Create table Sample ( ID int not null, Message nvarchar(max) null, CONSTRAINT [PK_ID_Msg] PRIMARY KEY CLUSTERED ( ID asc )...
View ArticleIndividual size of multiple backup files
Hi,Can I get the size of each backup file used in a multiple file backup with T-SQL?
View ArticleFind maximum number between two dates
hii am using sql server 2005.i have tabletbl_cashcounterCREATE TABLE [dbo].[tbl_CompanyMaster]( [CompanyID] [int] NOT NULL, [Name] [nvarchar](100) NULL, [YearStart] [datetime] NULL, [YearEnd]...
View ArticleSelecting unique column values for a specific key field.
I have the following table where col2 might have the same or different values and col1 is the key field. How can I select only the rows where col2 is different for col1 (like I have in the second...
View ArticleDebugging stored procedure in SQL Server 2012
Hi,Please I need your help.I used to debug stored procedures in SQL server 2008, 2008 R2. I'm debugging the stored procedure using SQL Server management studio. I just create a break point then I click...
View ArticleSQL Query (Rows)
Dear Experts .I have a table in SQL database (2008 r2)Table Name : Sample and it got 2 columns (ID,Desc)ID Desc96 Corrective96 Improve96 cardiovascular97 Abc97 EFG98 AAAAAAI...
View ArticleUpdate two table using single procedure
Hi Guys,Please can you help me to reframe this procedure. Currently it is taking more time for execution. i have four tables temp_table, table_account, table_recpt, table_dusr. Of which i will be...
View Articletempb db size identification
Hi, There is version store size counter in transaction category of performance monitor, and there is version_store_reserved_page_count col in dm_db_file_space_usageQ1) I wanted to know how should i...
View ArticlePerformance Merge Help
We have a table as follows- an employee can belong to multiple departments. a department can contain many employeesEmployeeId DeptJohn123 SalesJohn123 MarketingJohn123 AdsKevin32...
View ArticleFormatting output so that data repeated between rows is not shown
Hi Everyone,Here is a snippet of some sample data from a report that I have just written -Notice above that the 'Item Code', 'Item Description', and 'Order Qty' all repeat for rows 2 and 3.I would like...
View ArticleHow to execute the output of the below query automatically
Hi All,I want to execute the output of the below query automatically, instead of manually copying it and execute.select 'alter database ['+name+'] set recovery simple' from master.sys.databases where...
View ArticleRegarding the indexes on Tables
Hi, I am using two tables which has 5 millions of records in them, now i am trying to get the data from those tables to temp tables. I have added Non clustered indexes on them, but still the execution...
View ArticleHow to speed up complex views
I have a view that calls on a series of other views to build a cumulative results report. The way that it is structured the view has run for 20 minutes without a result before I cancel it. Here is the...
View ArticleHow to copy data between two tables row by row
Hi All, I have three tables TableA and TableB and TableC I wanted to write a stored procedure to copy data row by row from TableA to TableB and then update TableC by replacing any record that has the...
View ArticleTSQL Command to Open Table in Edit Mode Directly
One can right click on a table in SSMS to open in Edit mode. Is there a explicit TSQL Command to open the table directly in edit mode from a query window itself?John
View ArticleEmployee Status
Hi I am trying to solve a problem for a project and need some helpI need to create a trigger to stop an insert into salary table if the employee status is inactive....
View ArticleHow to select a max row for each group in SQL
Dear Frindz,I want select countries with maximum value of 'Value' for a 'grpid'. Also already selected 'Country' should not be considered for other 'grpid' while checking the maximum. ( ie Country or...
View Article