Weird Question About OVER PARTITION BY Query
I guess today is just my day to be confused...I feel really stupid as i've used the OVER (PARTITION) clause quite a bit.I'm wondering why my query isn't returning row numbers properly, i'm getting 1's...
View ArticleQuery in SQL Server 2005 Where in 2 column
Good day!! to allim kinda stuck in here...here is the senarioi have a table violationwith column of ID (primary key)DateCommitted (Date Time)TimeCommitted (Date Time)ViolationComitted (varchar(250))im...
View Articlelist all folders, and subfolders, in a directory
I'm trying to find a way to list all folders, and subfolders, in a directory. I ran the code below and got a message that says 'Access is Denied'. There is no way access is denied to that folder. How...
View Articlehow to concatenate
Hello every oneCan you please help with the below scenario1 A1 B1 C2 D2 E3 FI need output like1 ABC2 DE3 FCREATE TABLE [dbo].[Teja]( [value] [smallint] NOT NULL, [alpha] [nchar](10) NOT NULL ) ON...
View ArticleHow to use allies names in ON condition
i have the following query.SELECT DD.DATE_KEY , (SELECT MIN(NVI_DATE) AS NVI_MIN_DATE FROM FCT_SPA_NVI_OUTRIGHT A WHERE A.VENDOR_CODE=V.VENDOR_CODE) AS NVI_MIN_DATE , VO.BANK_ACCOUNT_NO , VO.BANK_NAME...
View ArticleSelect query based on joining of tables from different database is taking too...
Hi Team,Select query on table with millions of records is taking very long time. It took 50mins, the below query is joining on multiple table from two databases DB1.dbo.Table1 contains 100 million...
View ArticleUsing Delete Cascade a best practice?
Hi,My current requirement need to delete specific records from parent and also from child tables. So, DELETE CASCADE will be helpful.I need to know whether it is a good practice to use that? I hope it...
View Articleselect into casting not null question
OK here's a little thingy I just ran into, minor but curious.I'm doing a big select into with a union, and I want to mark the source of rows with code like:selectcast(0 asbit) as src, a, b, c, d,...
View ArticleProblem setting up Left Outer JOIN
I have a database with information about customers, sites, and servers. Here are the tables involved: CMCustomer: CustomerID and customer name CMSite: SiteID and Site name CMSiteServer: SiteServerID,...
View ArticleVisual studio 2010 SQL Concept
I need some help. Im trying to create application to return different recipes i can cook based on what ingredients I have in stock. I have two tables, Ingredients and Recipes. There are two columns in...
View ArticleXML Query
Hi All,I have a table with xml column as below<Description xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <Parameters>...
View ArticleRun several queries
I have several update queries that I want to run one at a time until: (0 row(s) affected) is in the message box. Once the query runs without any updates, I need the process to move to the next query....
View ArticleTrying to load data from specific fields in a text file
I'm trying to run this.INSERT INTO [London].[dbo].[SPGT] ([INDEX NAME]) SELECT ([INDEX NAME]) FROM 'C:\Documents and Settings\london-sql\Desktop\SPGT.TXT';I really want all fields, except for the...
View ArticleWorking on Localization - Decimal and Comma 'Decimal' Seperators
Note: SQL Server 2008 (Do not have the PARSE and TRY_PARSE functions available from 2012.) Hello, I am currently working on a project to offer a localization of an existing product to other languages....
View ArticleHelp Please Running Total with Date Gaps
I am using SQL Server 2008R2 I have a very simple table with 4 columnsDate, Product, Customer, SalesI need to accomplish 2 things, A running total by Product & Customer (I have figured this out),...
View Articletsql1
hi , I've two tables holiday and schedule tables according to the branchId.With the help of two tables i need count of non working days. ##SLADCSchedule--This table has the date ranges i.e...
View ArticleUpdate inner join
Hi, allI am a newbie to this. Any help is greatly appreciated. I have 2 tables. Copy and Serial. I want to update PONumber when CopyID matches in the 2 tables. So the end result would be CopyID 236059...
View ArticleOutput results to text file using T-SQL
I need to create a text file using sql view. let me know how it can be achieved using T-SQL. ANy help appreciated.
View Articlejoin same table 3 times, count from two other tables
Hi all! I have 3 tables RECORDS Id, Record_Id ITEMS Id, Record_Id ARTICLES Id, Record_Id I need to join RECORDS table 3 times R1,R2,R3 and get count of items R2 and R3 have and count articles that R3...
View ArticlePurging the data older than 1 year
I have a requirement to purge data older than 1 year.Table has 5 billion rows and delete about 4 billion rows in batches.there is no primary key or indexes on table.There is column Datetime and i...
View Article