CONTAINS predicate and Quoted text.
Hi,I am using CONTAINS predicate to find out SQL - Keywords in sql query. e.g. sql query - drop table t1in above sql query it find out 'drop' keyword.my requirement is that - CONTAINS should ignore the...
View ArticlePower Pivot
Hi ,I have a table that has customer,product,month ,year and month ,information . Now if the user passes the following value for the month period .Current Cycle --- Current Month ,Previous Month and...
View ArticleT-SQL - Using Column Name in where condition without any references when...
Hi All, I am a newbie for T-Sql, I came across a SP where multiple tables are engaged using multiple joins but the where clause contain a column field without any table reference and assigned for an...
View Articleyear less then 49
Hi All,For dates, why do we need to check whether the year is less than 49 criteria. if it is less than 49 then 19 else 20?Thanks
View ArticleID Column Problem
I need to have a unique non-null column in my table. I have set up an identity column with auto-increment and that works fine with one exception.I often make mistakes when updating or inserting new...
View ArticleInsert via openrowset
Hi,I know how to use openrowset to select rows from a remote serverIs it possible to use openrowset to insert rows into a table on a remote server? Could you give an example of the code?
View Articleconvert decode oracle pl/sq to ms sql and help required on logic
I have below oracle query need to converted to ms sql. I also want to add a record into journal table when a insert portion is executed "caseidinserted" and update portion executed then...
View ArticleHow to add 0's before the string in MS SQL server?
Hi,I need to add 0's to the left.my rule says that "loaded in this format:'002' + Equivalent SE PLU (5 digits) + '00000' + DV "Please provide the command which is equivalent to LPAD in oracle.Thanks in...
View ArticleRequired Output for Quarter
Hi ,I have a table that has customer,product,month ,year and month ,information .Sql ScriptsCreate Table SampleRevenue (Customer varchar(30), Product varchar(30), SMonth int , SYear int, Total...
View ArticleQuery to Locate Unicode Data types
I need a query to locate unicode data types? Any takers?
View ArticleNeed SQL code to show data into regular text instead of breakage
Hi All,I have a table with one column, lets say DataField as varchar(255)If I run select statement I get like thisSelect DataField from tableOutput:DataField A:01 B:02 C:03 D:04 E:05But when I copy /...
View ArticleHelp with GROUP BY with SUM
Hello all:I have always struggled with getting this right, so hopefully someone can assist with this. Basically I have two tables:CREATE TABLE [dbo].[Placement]( [PlacementID] [int] IDENTITY(1,1) NOT...
View ArticleReplace function - special characters
Hi All, If my column is encountering special characters I would like to replace with blank. Special characters may vary from record to record. Sometimes it is @ sometimes...
View ArticleFind stored procedures, views and table-valued functions that have SELECT *
How do I Locate stored procedures, views and table-valued functions that have SELECT '*' ? I am querying a database to locate all objects with SELECT '*'
View ArticleHelp in Complex query
Hi, I want to update the data of table #t1 and #t2 using the sample data. Help on this update.code_t1 column in #T1 and unique in #t1 and sharing the data in #t2 table. I want to update the @code_desc...
View ArticleTracking inserts and filtering by it
Hello everyone. I would like some advice on how to keep track of items involved in an insert, while the insert query is running. Once an item goes into a table, I don't want other items, related to...
View Articlemerge with case
I need your help pls...I have a requirement in merge - how do I handle below scenario? I know i can't put 3 matched. when matched and s.efforts =0 then update table1 set field1=somevalue,...
View ArticleConverting ALL CAPS data to real data - De-CAPITALIZING Addresses
I’m in a all SQLenvironment, so I need as “all SQL” an answer as possible.Can’t sell inserting a chunk of Java or whatever into an environment with no resources for that language.Anyone ever have to...
View ArticleRequired Output for Quarter v2 - Complex
hi All ,I have a table that has customer,product,month ,year and month ,information .Sql ScriptsCreate Table SampleRevenue (Customer varchar(30), Product varchar(30), SMonth int , SYear int,...
View ArticleDynamic SQL for Primary Key Declaration
RequirementCreate primary key constraint on tables which have been dynamically created. Primary keys are supposed to be created in line with the information from the metadata table. Some tables have...
View Article