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

OPENROWSET

I have daily schedule sql job which insert data into excel through OPENROWSET.but from last two days its not working.if I run query in query window it works but its not running under agent service....

View Article


Format Date Range in Select Statement e.b. 4/10/14 - 4/09/15

So far thanks for all the help you've provided me on here. I'm a long time Access developer and have just worked with SQL very little throughout the years but now I'm working full-scale in it, so a...

View Article


Purge table - older than four weeks data

Hi Experts,i have DB named "Test_Data" -> under this DB i have tables like a,b,c... and so on.in all the tables i have column "Week_no" and all table will have data, week_no wise.I want to write the...

View Article

SQL PROBLEM

why is this not giving me all the rows in the left column?SELECT I.[DESC], I.ITEM, CAST((I.COST2 - I.COST) / .75 AS DECIMAL(10,2)) AS OUNCES, SUM(A.QTY) AS QTY, (SUM(A.QTY) * CAST((I.COST2 - I.COST) /...

View Article

Help with Group By Query

Given the two tables below:Note that for CourseID=3 there is only one Student record and it is marked as deleted.insert into dbo.Course([CourseID],[Type],[InstructorID],[Location]) VALUES (1, '1', '1',...

View Article


IF STATEMENT WITH A CASE STATEMENT WITHIN A SQL SELECT

    SELECT CASE STATUS WHEN 'WO' THEN ISNULL(REPLACE(TempWOID, '~', '') , '')  ELSE CAST(INVOICE AS NVARCHAR(20)) END AS INVOICE,A.CUSTOMER, CAST(A.CUSTOMER AS NVARCHAR(50)) AS CUSTOMERSTRING, C.NAME,...

View Article

Run an Insert for each recordset iteration

I am trying to create a stored procedure, which will iterate through each row/record of a SQL statement and for each iteration, it will insert all the records from a table into another.I am from an...

View Article

Hierarchy Structure to SQL View

This may seem like a strange Question. I have a Hierarchy Table setupCREATE TABLE [dbo].[tblHierarchy]( [pkiID] [int] IDENTITY(1,1) NOT NULL, [fkiParentID] [int] NOT NULL, [intOrder] [int] NOT NULL,...

View Article


latest backup size - max(backup_finish_date)

Why does this query return multiple rows per database?select database_name, backup_size, max(backup_finish_date) from msdb.dbo.backupset where database_name = 'Ditest' and type='D' group by...

View Article


How to find?

Hello,i have a field like this in table.code02CT122302CT232302CT124102CT1123i want to find highest value from this field..how i get?this is highest value "02CT2323" how i get this value with query?

View Article

how to find the 5thMAX salary in the emp table.

suppose  if i having  100 rows i want to get 5th ,max salary having columns empid,empname,empsalaryjitendra

View Article

download folder from FTP server using batch file

could any one please let me know how to download a folder from FTP server.i am using windows 7 os and filezila FTP server.Thanks in Advance.

View Article

To fetch ALTERNATE records from a table. (EVEN NUMBERED)

suppose i having tABle employee columns empid,empname ,emplocation it having 20 rows and  i want to fetch 10 records which are even how to write queryjitendra

View Article


How to create this CSV in Sql query?

I have a order_detail table with the primary key order_detail_id and the foregin keys order_id and product_id. Also I have three other fields, A, B and C, to describe the nature of this order detail. A...

View Article

Test if returns values before return

In a stored procedure called by a VB.NET program, I build an SQL statement then use EXEC sp_executesql @SQL to run it.  I am selecting from one column based on certain criteria, but if this would...

View Article


Add decimal

We are trying to import a file.  File has field as 10 characters sample 0000002028.The import is expecting it to have a decimal.  How can I convert 0000002028 in the code to put the decimal in so it is...

View Article

Monitoring performance

We need to monitor performance in a multi-user environment. We have been using Sql profiler, but that seems to introduce some issues with performance degradation since it is a client-side tool. Is...

View Article


Inserting values into table.

Hi,I need to insert values like followinghttp://example.com/105.1.01http://example.com/105.1.02http://example.com/105.1.03......My query is to insert values automatically . For example the value should...

View Article

Extract date from string in T-SQL

Hi,I am having one field(AT_TEXT) in my database that has below kind of values. I want to extract date from this string but the issue is all rows has different format.1)One Month Lttr sent on 3/12/2009...

View Article

T SQL help

Hi All,Need help on following scenario. DECLARE @ProjectInvoice TABLE(InvoiceID INT, ProjectID INT, InvoiceAmount float) DECLARE @ProjectBudget TABLE(ProjectBudgetID INT, ProjectID INT, BudgetAmount...

View Article
Browsing all 23857 articles
Browse latest View live


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