Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 sql problem request with variables

Author  Topic 

phildelau
Starting Member

3 Posts

Posted - 2013-02-13 : 09:11:43
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 - 2013-02-13 : 10:56:12
Sorry it's not a field but a column
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2013-02-13 : 11:15:26
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 - 2013-02-13 : 11:37:23
I use Xampp with(apache, phpmyadmin).in which forum must be my question ?
Go to Top of Page
   

- Advertisement -