Quantcast
Channel: Transact-SQL forum
Browsing all 23857 articles
Browse latest View live

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 Article


How 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 Article


Replace 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 Article

INSTEAD 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 Article

Problem 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 Article


SQL 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 Article

separate a date out from a string

Hi,exec sp_readerrorlog  on SQL 2000 looks like this:ERRORLOG...

View Article

Get 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 Article


Stored 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 Article


Copy 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 Article

How 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 Article

stored 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 Article

Image may be NSFW.
Clik here to view.

Sql

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 Article


Help on Cursor with multiple insert Statements

Hi

View Article

Need 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 Article


Alise 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 Article

T-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 Article


How 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 Article

list 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 Article

Help 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
Browsing all 23857 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>