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

Querying previous months data

I have been tasked with pulling the previous two months of data from a table. The view looks like this.SELECT     TOP (100) PERCENT ItemNumber, SUM(ABS(CAST(ROUND(TransactionQty, 2, 1) AS DECIMAL(9,...

View Article


How to extract 250,000 Records into excel

Hi Friends In sql server My table has 250,000 records . How can I import these records into excel?If not  which file type I can use for it. Thanks for advance friends

View Article


Performance updating a extra huge table

Hi guys, just an advice. I'm handling table with more than 300 millions rows, sometimes even 800 millions and so far I came up with some good solution but now I really need to be concerned about the...

View Article

Convert Access SQL to SQL Server SQL

Below are my two query's top is from Access bottom is from SQL Server.  I know the access query is correct, but for some reason they are both returning different values.  What did I type incorrectly in...

View Article

Looking to improve slow running query

Hi,Is there any way of rewriting this query to make it more efficient? It's running pretty slow for me and If there are any glaring problems with the way its been written I'd like to fix them.SELECT...

View Article


How to send one single mail each time a table is updated with a batch of rows

Hi!I would like to send one mail each time an integrations services inserts a batch of rows. I,ve tested with this code but it sends one mail for each row that is inserted to the table. How to adjust...

View Article

Image may be NSFW.
Clik here to view.

Re-Arrange Columns?

I have a query that gives me the data that I want. I am being asked to present it is a certain format and I just can't find how to do it. I hope I am in the correct forum to start. I will post my sql...

View Article

how to search all Last name of Like use SqlServer ?

example : result After search for all last name of like in column [Full name]:              Full name                jon adil              sara adil              almn adil              bork adil...

View Article


convert datetime to date/very urgent

Hello expertsi am new to sql server and wants to change a column data type datetime to date in a view and i need to document that also, thank you.

View Article


daterange

I'm executing the below code i'm getting output as  below. DateFromDateTo 2014-01-01 00:00:00.0002014-01-20 23:59:59.000 But why i'm missing2014-01-21 00:00:00.000','2014-12-31 23:59:59.000'DECLARE...

View Article

DateRange

hi Experts,                     Could you Please help me on this query..I have @startdate ='2012-01-01 00:00:00.000',   @Enddate = '2014-01-31 00:00:00.000'in the table i have dateranges define if the...

View Article

Filtered index

I would like to create filtered index:WHERE col1<col2but it is not allowed. If I create computed column(col3=col2-col1) and use filter col3>0 it works, but as I remember there are some problems...

View Article

Select Statement with an "In-Line" Condition

I will try and keep this as simple and straight forward as possible. I want to generate a Select statement that will get me all my Products and their weight from my SQL database.  I would like to...

View Article


GROUP BY to combine/concat a column

Hi,SELECT         tblFuelCostDetails.TripId, tblFuelCostDetails.PurchaseDate,                tblPetrolPumps.PumpName+CONVERT(nvarchar(50), tblFuelCostDetails.Quantity) as Pump FROM...

View Article

query help

helle Experts..I have below table.My requirement is to get Number of Saturdays and Sundays which have values '0' within a given date range.Ex: Startdate= '2014-01-01 00:00:00:000',enddate = '2014-01-20...

View Article


How to get tab delimited text file when Stored Procedure executes ?

Hello Everyone,I have a stored procedure which returns 1 result set as an output.I want the output as a Tab Delimited Text file.I know that I can use SSIS and get the same output but I am not allowed...

View Article

How to retrieve data based on month end dates

Hi guysI need to get last 6 months of data grouped by month end dates....I need to automate this query so that it always looks for date for last 6 monthsHow do I achieve this?For ex my database has a...

View Article


Using CASE WHEN to check multiple rows of a table

So I have a table called MATERIAL with a field named MATERIAL_SHIPPED. It will either have a 1 or 0 value making it as shipped or not.There may be multiple materials for each PROJECT record. I want to...

View Article

Merge statement syntax for not matched not working

I'm receiving an syntax error on the statement below.    None of my corrections seem to be working.  Have something similar working on another server with 2008 r2. MERGE INTO...

View Article

Certificated stored procedure going squiffy

I have a certificated SP on DB1 using a linked server to DB2.  Inside the SP is "Execute as login='LinkUser'" where LinkUser is allowed to be impersonated by the login attached to the certificate...

View Article
Browsing all 23857 articles
Browse latest View live


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