Temporary Table

  • Thread starter Thread starter Dino Buljubasic
  • Start date Start date
D

Dino Buljubasic

Can somebody help with this problem please.

I need to create a temporary table from a table in SQL Server
database. The database table looks like:

id description other
1 aName ( 01/01/2000 - 01/01/2005) blah blah
.....
.....

I need to temporarily break this database table into a temporary table
of this form:

id desc startdate end date other
1 aName 01/01/2000 01/01/2005 blah blah
......
......

I need this so I can sort my temporary table by desc and startdate so
I can load this sorted info into my combo box.

I am thinking about using DataTable and DataRow objects but this does
not seam to be right way, or ???

Any help will be appreciated.
dino
 
Any help will be appreciated.

No need for a temporary table, assuming the structure of your data is
*EXACTLY* as you have specified for every record...

SELECT
id,
SUBSTRING(@strDescription, 0, CHARINDEX('( ', @strDescription)) AS
[desc],
SUBSTRING(@strDescription, CHARINDEX('( ', @strDescription) + 3, 10) AS
startdate,
SUBSTRING(@strDescription, CHARINDEX('- ', @strDescription) + 2, 10) AS
enddate,
other
FROM
<whatever your table is called>
ORDER BY
[desc], startdate
 
Thanks Mark,

I managed to finish it using a DataTable and DataView classes, it
works just fine.

Anyways, thank you for your help


Any help will be appreciated.

No need for a temporary table, assuming the structure of your data is
*EXACTLY* as you have specified for every record...

SELECT
id,
SUBSTRING(@strDescription, 0, CHARINDEX('( ', @strDescription)) AS
[desc],
SUBSTRING(@strDescription, CHARINDEX('( ', @strDescription) + 3, 10) AS
startdate,
SUBSTRING(@strDescription, CHARINDEX('- ', @strDescription) + 2, 10) AS
enddate,
other
FROM
<whatever your table is called>
ORDER BY
[desc], startdate
 
Back
Top