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

Parcing a text file to a sql table

Can you help me parse a txt file to a SQL table. Here is the exact format of the txt file... with the no space between the FreqDiff:#Time; SampleNum; SampleId; Moisture; Solids; Weight; Water;...

View Article


help with xml

Need I'm having the data as shown below. I want table results in the form of xml .So I'mUSINGXMLPATHTOGETtheresults.ButI'm looking for speciifc format .'--Declare a table...

View Article


Is there some sort of generic SQL that will fix hierarchical columns?

Ok...so we have this ASP.NET web form and application that utilizes hierarchical type to provide 3 tiers of information...1-3 visits...4-6 visits...7 or more visits. My question is this...if we change...

View Article

Conversion failed when converting date and/or time from character string

Hi,I am trying to run the following select statement and receive this error.select convert(date,convert(varchar,FiscalYearId)+'-'+convert(varchar,FiscalMonthOfYearID)+'-01') from...

View Article

Where Exists not working correctly

Hi, Below is my insert proc query insert into ODS.JJill.tODS_GLBalance ( tUTL_JobLogging_Key, PageNum, FiscalYearId, FiscalMonthOfYearId, Balance ) select DISTINCT @tUTL_JobLogging_Key,...

View Article


Automated Conversion from T-SQL to ANSI SQL?

Are there any tools that will convert from T-SQL to ANSI SQL? We are using SQL Server 2008 R2 SP2.The reason I ask is that we are testing some Data Appliances (Teradata, Neteeza, Hana, Greenplum) that...

View Article

BULK INSERT - COMMA DELIMITED FILE TO SQL SERVER FAILS ON ROW TERMINATOR

I am attempting to import a comma delimited text file into sql server using the bulk insert scriptBULKINSERTCSVTestFROM'c:\csvtest.txt'WITH(FIELDTERMINATOR=',',ROWTERMINATOR='\n') However the row...

View Article

T-SQL to get multiple rows into single row for the same ID group

Hi All,I have a table with 3 columns and my source data looks like..ID     Name    Role 1       Sam        TP 1       Tom        TP 1       John        TL 2       Rosy        TP 2       Deb          TL...

View Article


convert view to function

Hi,I have a view that are used to structure data and I have several reports using this view. One report could for instance use following query commands: Select case..., sum(...) from view join ......

View Article


Image may be NSFW.
Clik here to view.

Need help with a query

Hello, I have written a query to return me the following resultset which is just a sample of actual resultset. Based of this output I am trying to get another resultset which shd be:Is this possible to...

View Article

How to use where exists with a subquery

Hi,Below is my queryselect DISTINCT -1, vODS_GLBalance.PageNum, vODS_GLBalance.FiscalYearId, vODS_GLBalance.FiscalMonthOfYearId, GLAmount From ODS.Staging.vODS_GLBalance where EXISTS ( select * From...

View Article

How to pass a list of IDs to a stored procedure ?

Hi All,My table has two columns customerID (int) and customerNameI want to write a stored procedure that will get a list of integers and then return all the customers names associated with these IDs....

View Article

Query Help ?

Hi All,I have the data like below and from that data I want pick High,Avg and low values...

View Article


Query output in Excel

Hi ,    I have a job with number of queries. I need that output of the query in an excel format to a location whenever that job runs. Help me out.

View Article

How to join 2 tables on PK and FK relationship if some columns doesnt exist...

Hi,I have a table which has locationNum has PK lets call it TableA and i have 2nd table Table B which has LocationNUm as Fk referecing to Table A PK.Now, Table B has more LocationNum's than Table A and...

View Article


Stored Procedure delay execution

Good Afternoon,I am trying to execute 4 separate stored procedures, however I want to put a 10 second delay in between executing each procedure. The stored procedures are called SP_1, SP_2 etc.. Is...

View Article

PROBLEM WITH DBCC CHECKIDENT

Hello, I'm working with SQLSERVER 2008 R2, and I need use the DBCC CHECKIDENT for reseed an identity fieldDBCC CHECKIDENT(@TabbleName, RESEED, @newSeedValue); This statement does not give any result...

View Article


DATEDIFF returns wrong value

Hi,I have a simple statement below, which I expect to return values quarterly.  But with the given dates below it returns 1 and I expect 0 because there is no quarter passed between them.  Can anyone...

View Article

Query for fulfilment orders

I have table with orders and table with stock. The oldest stock(stock_id) must fill up the oldest orders (order_id) for appropriate item.I have created some test data and the required result. The logic...

View Article

Recursivel​y Fetch the Records in SQL Server using Functions

Hi Team,I have the source table with two columns as in Point 1 and if the user writes the query for ex -330335 Risk ID, we need to get all the related Risk Id's as in the Target Table.The query should...

View Article
Browsing all 23857 articles
Browse latest View live