help required for complex query
hi guys i need your help to write sql query where i need to fill null values when they are in between as you can see the same data is for 2 ids... i am able to fill null value for id 101 as it is the...
View ArticleGet back ids based on ids having all one status
I have a table CREATE TABLE [dbo].[myTable]( [p_id] [varchar](3) NOT NULL, [s_id] [varchar](9) NOT NULL, [d_name] [varchar](9) NOT NULL, [status] [varchar](1) NOT NULL)And it has the following data.1 1...
View ArticleException calling "ExecuteNonQuery" with "0" argument(s): "CommandText...
I have CSV file which has sdimiler data I am inserting those date to desinated table and while executing this query mentioned below I get error mentioned in TITLE insert into...
View ArticlePerformance Tuning of View
Hi All,I have 2 tables.Parts and Part_PropertyPartsPart IDStatus 1Complete2Pending3CompletePart PropertyPart IDStatusPart TypePart String1Complete ActiveTrue1Complete Data_StatusRaw1Complete...
View ArticleCount of Matching Values on the Basis of Date
Hi,I've data in two table. Table1 has two column named as of InvoiceDate (DateTime) & InvoiceNumbers (Numeric) and Table2 has 3 columns InvoiceDate (DateTime), InvoiceNumbers (Numeric) &...
View ArticleWrite dynamic query using User-Defined Table Types
Hi,I have a User-Defined Table Types ( @SelectedDBDt AS dbo.SelectedDBList READONLY) and sending values from coding .Let assume this is the data for @SelectedDBDt...
View ArticleHow to set Identity on Var char column?
Hi, I need to create a table with identity column, but the identity should be in string format. But In my table the column datatype is var char.I need to increment to my column values like...
View ArticleGrant View Server State to Role / Login / User using SMO
Hello AllI know that GRANT VIEW SERVER STATE TO User1 Or by writing GRANT VIEW SERVER STATE TO Login1I can set this permision. But I want to set same kind of permission using SMO.If possible then can...
View ArticleUTC or GMT to Australia Local DateTime Conversion (Melbourne, Victoria)
Hi Guys,I have to convert UTC or GMT DateTime to Australia Local DateTime Conversion (Melbourne, Victoria) and we need to consider Daylight Saving which starts every Year October first Sunday so Time...
View ArticleHow to update or insert an ID using a stored procedure in table
Environment: Win7 and SQL server 2008 R@Tools: SQL management tool 2008 R2T-SQL code - works fine- :DECLARE @return_value int, @new_id char(9) EXEC @return_value = [dbo].[proc_gen_id] @new_id = @new_id...
View ArticleCheck two columns and update other table
HI ,I have a table called trackCenterline .Below is the table.What i want to do is If the segmentSequenceID is 1 it should pick the corresponding SegmentID i.e 10001 and Check for the same segment id...
View Articleinner join through View extremely slow
I have a very large database (several TB) where I am doing a complex inner join between three tables. The largest of the tables has a simple View on it. In fact, it looks pretty much just like the base...
View ArticleCan you get the file name of the current executing TSQL script?
Can you get the file name of the current executing TSQL script? I wrote entries to a generic log file and would like to include the script name.
View ArticleE-Mail notifications occurring on success despite configuration in job
Hello -- We are running SQL Server 2008R2 and have several scheduled jobs as part of an overall Maintenance Plan. One of the jobs is the Transaction Log backup. The job in question is configured to...
View Articlehelp with following script file
I list store procedure and error message. what's problem? How to fix it? I print (@SQLString) before Exec (@SQLString).Thanks!USE [msdb] GO/****** Object: StoredProcedure...
View ArticlePerformance efficient function to strip punctuation marks
Hi,We are looking at a scenario of stripping a set of columns (like address for example) of a certain set of punctuation marks. We are currently using a user-defined scalar function containing a set of...
View ArticleNeed Logic in sql
Declare @table table (EMPIID int, NAME VARCHAR(10),Updatedate datetime)INSERT into @table values(111,'Muthu','02/13/2014') INSERT into @table values(222,'Mari','02/14/2014') INSERT into @table...
View ArticleGet table size for set of rows in SQL server?
Hi,I know to get the size of the table by using "sp_spaceused 'TableName'" and size of the column by using "select SUM(datalength(columnName)) from TableName where columnName like '%value%' "Please...
View ArticleSelect query based on joining of tables from different database is taking too...
Hi Team,Select query on table with millions of records is taking very long time. It took 50mins, the below query is joining on multiple table from two databases DB1.dbo.Table1 contains 100 million...
View Articletsql
hi , I've two tables holiday and schedule tables according to the branchId.With the help of two tables i need count of non working days.##SLADCSchedule--This table has the date ranges i.e...
View Article