Need Logic in sql
Declare @table table (EMPIID int, NAME VARCHAR(10),Updatedate datetime)INSERT into @table values(111,'Muthu','02/13/2014') INSERT into @table values(222,'Mari','02/14/2014') INSERT into @table...
View ArticleStoring images using URL or Binary data ?
Dear all,I have seen different type of database architecture where some were storing Pictures and document as Binary data in the database while some others were just defining the url to access the...
View ArticleDoes ON UPDATE CASCADE work in this scenario??
Hello guys, I created a Database as follows, what I need to do is anytime an item is ordered, the quantity should be deducted accordingly on the Rentals.Products table, from what I read, the ON UPDATE...
View ArticleT-SQL financial year quarter
Hi All,In my requirement Financial year starts from Nov to Oct.According to This in FEB 14 its 2014 Q2.My query is like below SELECT 'Q'+DATENAME(Quarter, CAST(CONVERT(VARCHAR(8), Getdate()) AS...
View ArticleIssue converting the following query to text.
Hello guys, I'm trying to convert the following query to text and to use PRINT so that it returns theresult in the picture as output, help would be appreciated, thanks :)SELECT EventName, EventDate...
View ArticleHow to find the max value from a join query within a query
I have the following join query within a query which produces the correct results but I cannot work out how to get the max value of MaxInvQty.Can anybody help or guide me please?regardsRonleftjoin...
View ArticleScript or Dababase Query
Hello,I'm not sure how I'd accomplish the following. I appreciate any assistance you can give.When column NewRevRequired = Yes; I need to get the last revision code in desc order and afterwards...
View ArticleSQL COUNT data by date, and then COUNT by date range
Hi All, hoping someone can help point me in the right direction here. I am using SQL2005 and need to perform some counts based on date ranges.An extract of table looks as follows (real table is several...
View ArticleHow to get TOP 5 and LAST 5 in one query ?
Hi again guys, i'd like to get this query to bring the result in one single query instead of 2 separate results, can you please explain how this can be done? I did some online research but found...
View Articleget the max date from table
hii have below data in my table.instance entrydate program code1 02/22/2013 50 df2 03/03/2014 4 gf3...
View ArticleWeekly Aggregation based on everyday date
Hi All,i have a table with 3 columns. Id , MeasureDate,Measure. Here Id +MeasureDate as primary key. In this table i want add a column Avg. if i am running today 2/12/2014,2/5/2014,01/29/2014 and...
View ArticleFilter rows based on Where condition AND-OR ?
Hi,I have table "Table1" and columns are IdAddendumNo ClaimNo Description1A1C1D12A1C1D23A1C2D14A2C3D35A2C1D2I have three controls in the UI.If I give txtA1.Text =”A1” only then should be return Id-...
View ArticleMicrosoft TechNet Wiki T-SQL Guru - Winners for January!!
The results for January's TechNet Guru competition were posted!http://blogs.technet.com/b/wikininjas/archive/2014/02/16/technet-guru-awards-january-2014.aspxPost your FEBRUARY contributions...
View ArticleSchedule a recurring SQL database backup
Hello,I am trying to set up a recurring backup job in SQL Studio Management 2008 to back up one database 5 days a week, Monday through Friday. I would like the name of the backup file to be in format...
View ArticleUTC or GMT to Australia Local DateTime Conversion (Melbourne, Victoria)
Hi Guys,I have to convert UTC or GMT DateTime to Australia Local DateTime Conversion (Melbourne, Victoria) and we need to consider Daylight Saving which starts every Year October first Sunday so Time...
View ArticleHow can i loop through record set BY sql
I have record set which is result of select * from table ... 1 A 02 B 13 C 1I want to loop through all row and check last column of each row. I dont know how to do this in SQL for...
View Articlelinked server issue on sql 2000 sp4
i am getting below error while running a select statement with linked server to oracle provider with oledb.Server: Msg 7399, Level 16, State 1, Line 1 OLE DB provider 'OraOLEDB.Oracle' reported an...
View ArticleHow to filter system query from DMV ?
Hi:I want find many information about T-SQL " User Query " from DMV, but it also return SQL Server System Query.How Can I remove the System Query ? This is my sample codeSELECT TOP 50 TextData =...
View ArticleHow to test basic sql queries online(for Sql Server 2012 and up versions) ?
Hi,I need to test basic sql queries using sql server without installing Sql Server on to the system.Do we have such readymade online help, which can solve such difficulties ?Please sugest some of...
View ArticleCustom Database
Do i could make the database like this? **Note: One table named "Database" with on the left is "Student Name" and on the top is "Month Payment", the CheckBox is the CheckBox in c# winforms. What I...
View Article