I wonder if one can provide a little code on checking a string in a column 'Column1' of table 'table1', if it does not contain sequence of the characters 'ABC.' to add it to each record in the column 'column1'.
RITESH writes "sir , i am in a problem ,plz help me , my question is i want to make a query in which there is two table containing column vrdt, power_remark format is like this--- table1 vrdt remak 09/09/06 a 09/09/06 b
answer format will be table 2 vrdt remark 09/09/06 ab"
I'm new to the forum, and semi new to sql, I've been working with it for about 1 year now, but from a programmers side. I simply just plug in my selects, and inserts, but most of my work is in asp.net. I apologize if I have posted in the wrong forum section. Here is my problem....
I have a table that has the follwing columns.. UserName, question1, question2, Id
question1 and question2 columns simply hold either 'Y' or 'N' Meaning that the user either answered Y or N for the questions.
I'm trying to create another column on the fly... example....
select *, [othercolumn] = case question1 when 'Y' then 'question1,' else '' end from mytable
If both questions1 and questions2 have the column value of 'Y', then the othercolumn should have 'question1,question2' as the end of the above select.
The above example only works for checking for question1, but I will need to do the same for question2 and concatinate that into the othercolumn column.
I hope, I have explained myself well. Please let me know if you need more info from me.
I have a query in SSIS which works fine. SELECT SUBSTR(DOB_CHAR, 7, 2) AS EXP3, SUBSTR(DOB_CHAR, 5, 2) AS EXPR1, SUBSTR(DOB_CHAR, 1, 4) AS EXPR2 FROM WAITLIST results
20 12 1948
07 09 1982
29 07 1960 However, when I try to concatinate, it falls over SELECT SUBSTR(DOB_CHAR, 7, 2) + '/' + SUBSTR(DOB_CHAR, 5, 2) + '/' + SUBSTR(DOB_CHAR, 1, 4) AS EXPR2 FROM WAITLIST
The syntax works ok on SQL Server query, but not in SSIS. (Reading from Oracle, number 19481220, an is varchar2)
I have a need to concatenate all Descriptions from a select statementSELECTt_ReviewSection.PeerRevSectionDescriptionFROMt_ReviewSectionWHEREt_ReviewSection.PeerRevID = @lngRevIDORDER BYt_ReviewSection.PeerRevSectionOrderI want to return a single string "section1, section2, section3, section4"based on the multiple rows returned.Any ideas
when I'm in MediaImportLog , I want use column ImportSource to compare with column ChainCode in table BillerChain ( so I get BillerInfoCode) and then use the BillerInfoCode I got to compare with column BillerCode in Table Bill ( I get CompanyCode) finally I use CompanyCode to compare with column CompanyCode in table DataBackup so I can get the company's keepmonth How can I get the keepmonth? can I use parameters ?
I remember reading that you can compare the schema of 2 databases to see if there are any diferences. For the life of me, I can not remember where I read it or what it is called. Any help would be great!
If we use operator < <= > >= to compare NON nummeric, then how it is being compared..? what it returns? eg : .... WHERE someObj1.UniqueX <= someObj2.UniqueX
public string Compare(StoredProcedure storedTarget)
{ string storedScript = string.Empty; if (storedTarget.RoutineDefinition != this.RoutineDefinition) { // string storedScript = (@"ALTER PROCEDURE ); <--- How can i put new stored procedure ?????? What is sql code for this work ? } } Thank You all sql guru s
I have an application that writes records with a timestamp to an sql table.
I wish to compare the values in each field and see if they have changed from the previous record and then delete if they haven't. Can anyone offer a script or procedure to do this please?
hi i doing a project like "IMesh", whatever ,i will take a sentencefrom the user and want to retrieve all row from the table has similarwordsfor example the user enter "programming with c#" so i retrieve allfields that contain "programming" or "c#"some thing like what a search engine dothanx
I need to compare tow dates DateField1 and DateField2 and find number of hours between these two dates. Then I need to deduct non-business days and hours (Business days: Monday-Friday and Business Hours: 7:00am-7:00pm) from this and find net hours. How can I do this?
Hi, I have two varchar column in SQL.there im storing Month name Lets say, col1 col2 JAN APR MAY DEC Is there any possibility to use the sql query select * from tablename where DEC between (col1,col2) I just wonder since it is varchar field and not date field can i use this syntax to compare ? or any other better way to achieve this? Thanks for any response. Regards, RR
Hi,I need to compare Todays Date with a Date in the Table (DateExpired)to see if the membership expired. How do I do that? thanks SELECT DateExpired FROM Member
i am making a transaction function for my website, when people transfer an amount from account A to account B, it should check the amount if account A has enough money to transfer. here is my codes, should i add an if statement before the tra.update()? how to write this codes? SqlDataSource tra = new SqlDataSource(); tra.ConnectionString = ConfigurationManager.ConnectionStrings["shuliConnectionString"].ToString(); tra.UpdateCommand = "update account set balance=balance" + -Convert.ToDecimal(TextBox5.Text) + " where AccountNumber = '" + TextBox3.Text + "'"; tra.Update(); tra.UpdateCommand = "update account set balance=balance+" + Convert.ToDecimal(TextBox5.Text) + "where AccountNumber = '" + TextBox4.Text + "'"; tra.Update(); tra.InsertCommand = "insert into Transactions(TransactionType,AccountNumber,DestAccount,Amount,Comment,ModifyDate) values ('T','" + TextBox3.Text + "','" + TextBox4.Text + "','" + TextBox5.Text + "','" + TextBox2.Text + "','" + DateTime.Now.ToLocalTime() +"')"; int inertRowNum = tra.Insert(); Server.Transfer("deposit_withdraw_confirm.aspx");
Hi, I have a table with 3 columns inside - record_id (int) - user_id (varchar) - login_date (date) it is a many-to-many relationship table that record login date of users
Now, I want if I want to COUNT the users who login before 31 May 2008, I would use SELECT COUNT(*) FROM table1 WHERE login_date < '2008-31-05'
That's works
But the problem is I want to split the result to - How many people have login in the last 0-5 days (based on the input (31 MAY 2008)) - How many people have login in the last 6-10 days (based on the input (31 MAY 2008))
I have table:ArticleIDSubjectBodyDateThe Date field have data:12.02.200512.02.198912.02.156314.09.134530.12.345I need to show Articles wiich have date today. Example:If today is 12.02.2008 I should show only Date with value 12.02. The results:12.02.2005 12.02.1989 12.02.1563 I try something with DAY, Returns an integer representing the day datepart of the specified date but it's doesn't work.Help :)
Hi,I have a field TestDescription in tableA in DatabaseA. The data in this field is coming from three different fields in three different fields in DatabaseB.Is there a way to write a script to check if the length of this field TestDescription is greater than length of all those three fields in DatabaseB?Thanks
I want to know how can I write a sql to compare 2 dates which can run in SQL Query Analyzedeclare @date1 datetime, @date2 datetime set @date1 = '2005-01-22 12:00:05'set @date2 = '2005-01-22 13:05:01'how can I compare whether @date1 = @date2 in terms of (YYYY-MM-DD) only?
how can i compare date @date1, @date2, @date3I want to check whether @date2 <= @date1 AND @date1 < @date3 in terms of (comparing Year, Month, Day ONLY)Those date don't need to compare the time.Any idea?
I am faced with and issued where I have to create a database using the ddl created from ERWIN. Since the version of ERWIN i am using is not compliant with MSSQL7, there is some massaging of the script that is created by ERWIN that has to be done on my part.
This of course will lead to errors. What I am looking for is a script (select statement) that will compare objects in one database to objects in the another database, with the goal of having the two databases identical in all aspects (tables, indexes, procs, triggers, etc..)
I need to be able to reliably say that a database created by my script is the same as an existing database (which has been altered manually)
I need to compare two identical tables and return the rows that are different,they are not having any primary key. Anyone to help with the query? Thanks.
Is it possible (easily) to compare two identical tables (one from server1 'SQL7', one a download from an Oracle DB into SQL7) to see if the Oracle table has changed, what is the changed row and place said row into another table to do some other process on those changed rows?
Is there a way by which I can compare 2 databases?...I mean get to know, the differences in the 2 databases, so I can update the other, accordingly....? Any suggestions would be appreciated. Thanks in advance:-)
Is there any not too complicated way, that I compare a with b, and if there is no match, update b one - (include, insert the whole row, if there is no in b)?
Need help with the structuring of the following query: I've got 2 tables nl :tableA, tableB I need to do a query to determine wat DISTINCT values of a column(cIdNo) in tableA is not present in column (bIdNo) in tableB.
tableA contains Id numbers of people who still has to pay their bills, and tableB contains Id numbers of people who already paid. So I want a query to determine who still needs to pay.
I've tried the following but doesn't work, not to sure if it's the right wayto do it:
PHP Code:
SELECT distinct(cIdno) as IdNumber FROM tableA LEFT JOIN tableB ON tableA.cIdNo != tableB.bIdNo