SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 sql problem request with variables
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

phildelau
Starting Member

3 Posts

Posted - 02/13/2013 :  09:11:43  Show Profile  Reply with Quote
Hello,
In my table , i've a field "ad_datededepartoccasionnel". The content is a date in text format (I can't change it's format) dd-mm-yyyy. I must edit ads by descending order, but it's sort by day.
So I want to permute dd with yyyy

I Tried this code but an error occurs at UPDATE string. I 'm not a programmer, therefore I ask some help.
this is the code below

SELECT @annee := SUBSTR(ad_datededepartoccasionnel,7,4),@jour := SUBSTR(ad_datededepartoccasionnel,1,2)FROM cov_adsmanager_ads
UPDATE cov_adsmanager_ads SET ad_datededepartoccasionnel= REPLACE(ad_datededepartoccasionnel,@annee,@jour)
UPDATE cov_adsmanager_ads SET ad_datededepartoccasionnel= REPLACE(ad_datededepartoccasionnel,@jour,@annee)

Sorry for my english

Thanks

phildelau
Starting Member

3 Posts

Posted - 02/13/2013 :  10:56:12  Show Profile  Reply with Quote
Sorry it's not a field but a column
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

India
52325 Posts

Posted - 02/13/2013 :  11:15:26  Show Profile  Reply with Quote
this doesnt look like t-sql. whats the rdbms that you're using?

This is ms sql server forum so if you're using something else you may be better off posting them in relevant forums.

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

phildelau
Starting Member

3 Posts

Posted - 02/13/2013 :  11:37:23  Show Profile  Reply with Quote
I use Xampp with(apache, phpmyadmin).in which forum must be my question ?
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000