Generating working schedules
Hi, Hope someone can help me with this: I would like to generate a working schedule for employees for x-days ahead based on a starting date that the user can enter. I have got 3 relevant tables: 1....
View ArticleHow to omit records based on a status code
I am trying to select records based on a status 'N' or 'A' by a certain date as long as by the chosen date there is not another status given to the same course like 'D' or 'X'.Here are some sample...
View ArticleReplace function in where clause IN (list)
DECLARE @DNNo NVARCHAR(15), @InvDNNo NVARCHAR(200) SELECT @DNNo='11-0748-DN01', @InvDNNo='11-0748-DN01,11-0748-DN02,11-0748-DN03,11-0748-DN04' Select 1 Where @DNNo IN (''''+...
View ArticleINSTEAD OF UPDATE Trigger and row currency
I am having trouble getting an INSTEAD OF UPDATE Trigger to update the correct row. It ends up updating all the rows in the Table. I need the View/Trigger because I am calling a UDF on some of the...
View ArticleProblem reading sharepoint 2010 lists using TSQL openrowset from SQL2008r2
I have several different SQL servers reading sharepoint lists. However, I'm trying to configure another SQL server and I just can't get it to work. Here is the error message:Msg 7399, Level 16, State...
View ArticleSQL Server Function to Format Hash String
Hi, I have a requirement wherein I need to Read the length of the string remove first 2 characters Insert Hyphens ( dashes) between the 2 successive charactersExample : Initial String :...
View Articleseparate a date out from a string
Hi,exec sp_readerrorlog on SQL 2000 looks like this:ERRORLOG...
View ArticleGet Matching and Non-matching rows
I want to be able to join 2 tables on a common column but get both those that match and those that do not match. For example use the following 2 select statements.SELECT RepairOrderID, Customer FROM...
View ArticleStored procedure to export result to excel header not displayed
Hi,I am using below stored procedure to export data to excel with header. but it is not displaying the header . i believe this is because the max length of query can be 8000. but I have more than 250...
View ArticleCopy new records from Oracle table to SQL Server table then update Oracle table.
I am copying records from an Oracle table that are flagged Incomplete(2) to a SQL Server table that are new to the SQL Server. Then I want to update the Oracle table's flag for those records to...
View ArticleHow do you handle underscore
Hi everybody,I am wondering what approach do you take in handling underscore character in searches. Do you apply some special treatment and if yes, what is your approach.Example:declare @t table (email...
View Articlestored procedure with more than 1 value for each parameter
In an SSRS 2008 r2 report, I am currently calling a stored procedure called spRoom. I obtain the results of the stored procedure by creating a temptable called #roomReultsThe temp table that I am...
View ArticleSql
I have a database that looks like this:I need to be able to get all the columns of one mangroup based on a search. The user will type in [type2] FPR = [disc] 2.50 and [type2] low = [disc] 1.00 and I...
View ArticleNeed a sql query to get the difference between two timestamp in the format of...
I have a database table where it keeps record of the transaction when it starts at StartTime and when it ends at EndTime. Both these entries are having the timestamp entries. Say for example, I have a...
View ArticleAlise column with variable value in SQL Script
Hi All, How to alise a column Name to a variable value.. Declare @test as Varchar(20) Select Column_A From Table_A In above query i want to alise for column_A as @test variable value
View ArticleT-SQL for finding the unused tables which are consuming maximum disk space.
Hi,Need help in writing a T-SQL that can return me the unused or least used tables in a database and are consuming a lot of disk space.Thanks
View ArticleHow to distribute IDs over many rows using predefined distribution
I have a table that shows how many rows in one table should be assigned IDs in another table. The best anology I can think of using is containers and marbles. So here is what the distribution table...
View Articlelist of Like condition from one Lookup table.
Hi,I have 2 tables. SourceData table and LookUp table . SourceData table has one column called SNameSNameJayesh Krishnan Karthik Kumar Liju Sharma Kumar Jayesh Kumar Pradeep Lookup table has one...
View ArticleHelp Writing Query
I have two tables one that contains employees who are not eligible for rehire and one that contains employee information. I want to query a count of employees where the employeename is not in the...
View Article