![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Have a table with 9 digit dimensioncode...need to make a new table with a 7 digit dimensioncode...is there any way I can get the name of the first 9 digit dimensioncode and use it as name for the new 7 digit dimensioncode ? Without using Cursors ? Perhaps Cursors isn't a problem with only 50.000 records...? \Michael Vardinghus |
#3
| |||
| |||
|
|
Could you show us some structure, before data and what you want to see post change? Cursors are not always a problem but should be avoided if you can. -- ---------------------------- Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) www.SQLDTS.com - The site for all your DTS needs. I support PASS - the definitive, global community for SQL Server professionals - http://www.sqlpass.org "Michael Vardinghus" <michaelvardinghus (AT) notexisting (DOT) com> wrote in message news:O74T%23NUTEHA.240 (AT) TK2MSFTNGP11 (DOT) phx.gbl... Have a table with 9 digit dimensioncode...need to make a new table with a 7 digit dimensioncode...is there any way I can get the name of the first 9 digit dimensioncode and use it as name for the new 7 digit dimensioncode ? Without using Cursors ? Perhaps Cursors isn't a problem with only 50.000 records...? \Michael Vardinghus |
#4
| |||
| |||
|
|
Table 1: Dimcode Dimname 210000000 Olap solution, fase 1 210000001 Olap solution, fase 2 220000001 Building a ship, fase 1 220000002 Building a ship, fase 2 Sadly to say there is no structure in the dimname field so I don't have an exact number to for ... would just have to set a number and use this .. could be 15-20 characters. With 15 it would be...(matches my examples but some will be cut off...) Table 2: Dimname 2100000 Olap solutition 2200000 Building a ship \Michael V. "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> skrev i en meddelelse news:%23RlvodUTEHA.2416 (AT) TK2MSFTNGP09 (DOT) phx.gbl... Could you show us some structure, before data and what you want to see post change? Cursors are not always a problem but should be avoided if you can. -- ---------------------------- Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) www.SQLDTS.com - The site for all your DTS needs. I support PASS - the definitive, global community for SQL Server professionals - http://www.sqlpass.org "Michael Vardinghus" <michaelvardinghus (AT) notexisting (DOT) com> wrote in message news:O74T%23NUTEHA.240 (AT) TK2MSFTNGP11 (DOT) phx.gbl... Have a table with 9 digit dimensioncode...need to make a new table with a 7 digit dimensioncode...is there any way I can get the name of the first 9 digit dimensioncode and use it as name for the new 7 digit dimensioncode ? Without using Cursors ? Perhaps Cursors isn't a problem with only 50.000 records...? \Michael Vardinghus |
#5
| |||
| |||
|
|
Table 1: Dimcode Dimname 210000000 Olap solution, fase 1 210000001 Olap solution, fase 2 220000001 Building a ship, fase 1 220000002 Building a ship, fase 2 Sadly to say there is no structure in the dimname field so I don't have an exact number to for ... would just have to set a number and use this .. could be 15-20 characters. With 15 it would be...(matches my examples but some will be cut off...) Table 2: Dimname 2100000 Olap solutition 2200000 Building a ship \Michael V. "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> skrev i en meddelelse news:%23RlvodUTEHA.2416 (AT) TK2MSFTNGP09 (DOT) phx.gbl... Could you show us some structure, before data and what you want to see post change? Cursors are not always a problem but should be avoided if you can. -- ---------------------------- Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) www.SQLDTS.com - The site for all your DTS needs. I support PASS - the definitive, global community for SQL Server professionals - http://www.sqlpass.org "Michael Vardinghus" <michaelvardinghus (AT) notexisting (DOT) com> wrote in message news:O74T%23NUTEHA.240 (AT) TK2MSFTNGP11 (DOT) phx.gbl... Have a table with 9 digit dimensioncode...need to make a new table with a 7 digit dimensioncode...is there any way I can get the name of the first 9 digit dimensioncode and use it as name for the new 7 digit dimensioncode ? Without using Cursors ? Perhaps Cursors isn't a problem with only 50.000 records...? \Michael Vardinghus |
#6
| |||
| |||
|
|
But i cannot rely on the comma....can substring be used to pull out the number of characters in too strings that are identical ? "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> skrev i en meddelelse news:uSwzM9UTEHA.3016 (AT) tk2msftngp13 (DOT) phx.gbl... From your initial description here you can SUBSTRING the DimName attribute using CHARINDEX(0 to find the comma. -- ---------------------------- Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) www.SQLDTS.com - The site for all your DTS needs. I support PASS - the definitive, global community for SQL Server professionals - http://www.sqlpass.org "Michael Vardinghus" <michaelvardinghus (AT) notexisting (DOT) com> wrote in message news:urZCjoUTEHA.204 (AT) TK2MSFTNGP10 (DOT) phx.gbl... Table 1: Dimcode Dimname 210000000 Olap solution, fase 1 210000001 Olap solution, fase 2 220000001 Building a ship, fase 1 220000002 Building a ship, fase 2 Sadly to say there is no structure in the dimname field so I don't have an exact number to for ... would just have to set a number and use this ... could be 15-20 characters. With 15 it would be...(matches my examples but some will be cut off...) Table 2: Dimname 2100000 Olap solutition 2200000 Building a ship \Michael V. "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> skrev i en meddelelse news:%23RlvodUTEHA.2416 (AT) TK2MSFTNGP09 (DOT) phx.gbl... Could you show us some structure, before data and what you want to see post change? Cursors are not always a problem but should be avoided if you can. -- ---------------------------- Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) www.SQLDTS.com - The site for all your DTS needs. I support PASS - the definitive, global community for SQL Server professionals - http://www.sqlpass.org "Michael Vardinghus" <michaelvardinghus (AT) notexisting (DOT) com> wrote in message news:O74T%23NUTEHA.240 (AT) TK2MSFTNGP11 (DOT) phx.gbl... Have a table with 9 digit dimensioncode...need to make a new table with a 7 digit dimensioncode...is there any way I can get the name of the first 9 digit dimensioncode and use it as name for the new 7 digit dimensioncode ? Without using Cursors ? Perhaps Cursors isn't a problem with only 50.000 records...? \Michael Vardinghus |
#7
| |||
| |||
|
|
From your initial description here you can SUBSTRING the DimName attribute using CHARINDEX(0 to find the comma. -- ---------------------------- Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) www.SQLDTS.com - The site for all your DTS needs. I support PASS - the definitive, global community for SQL Server professionals - http://www.sqlpass.org "Michael Vardinghus" <michaelvardinghus (AT) notexisting (DOT) com> wrote in message news:urZCjoUTEHA.204 (AT) TK2MSFTNGP10 (DOT) phx.gbl... Table 1: Dimcode Dimname 210000000 Olap solution, fase 1 210000001 Olap solution, fase 2 220000001 Building a ship, fase 1 220000002 Building a ship, fase 2 Sadly to say there is no structure in the dimname field so I don't have an exact number to for ... would just have to set a number and use this .. could be 15-20 characters. With 15 it would be...(matches my examples but some will be cut off...) Table 2: Dimname 2100000 Olap solutition 2200000 Building a ship \Michael V. "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> skrev i en meddelelse news:%23RlvodUTEHA.2416 (AT) TK2MSFTNGP09 (DOT) phx.gbl... Could you show us some structure, before data and what you want to see post change? Cursors are not always a problem but should be avoided if you can. -- ---------------------------- Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) www.SQLDTS.com - The site for all your DTS needs. I support PASS - the definitive, global community for SQL Server professionals - http://www.sqlpass.org "Michael Vardinghus" <michaelvardinghus (AT) notexisting (DOT) com> wrote in message news:O74T%23NUTEHA.240 (AT) TK2MSFTNGP11 (DOT) phx.gbl... Have a table with 9 digit dimensioncode...need to make a new table with a 7 digit dimensioncode...is there any way I can get the name of the first 9 digit dimensioncode and use it as name for the new 7 digit dimensioncode ? Without using Cursors ? Perhaps Cursors isn't a problem with only 50.000 records...? \Michael Vardinghus |
#8
| |||
| |||
|
|
You need to have a way of identifying the string some way. From what you have just said the string can be any format. If you can consistently say something like "The dimension name is the first string/2 strings" then sure you can use SUBSTRING -- ---------------------------- Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) www.SQLDTS.com - The site for all your DTS needs. I support PASS - the definitive, global community for SQL Server professionals - http://www.sqlpass.org "Michael Vardinghus" <michaelvardinghus (AT) notexisting (DOT) com> wrote in message news:%23or%23MAVTEHA.1468 (AT) TK2MSFTNGP09 (DOT) phx.gbl... But i cannot rely on the comma....can substring be used to pull out the number of characters in too strings that are identical ? "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> skrev i en meddelelse news:uSwzM9UTEHA.3016 (AT) tk2msftngp13 (DOT) phx.gbl... From your initial description here you can SUBSTRING the DimName attribute using CHARINDEX(0 to find the comma. -- ---------------------------- Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) www.SQLDTS.com - The site for all your DTS needs. I support PASS - the definitive, global community for SQL Server professionals - http://www.sqlpass.org "Michael Vardinghus" <michaelvardinghus (AT) notexisting (DOT) com> wrote in message news:urZCjoUTEHA.204 (AT) TK2MSFTNGP10 (DOT) phx.gbl... Table 1: Dimcode Dimname 210000000 Olap solution, fase 1 210000001 Olap solution, fase 2 220000001 Building a ship, fase 1 220000002 Building a ship, fase 2 Sadly to say there is no structure in the dimname field so I don't have an exact number to for ... would just have to set a number and use this .. could be 15-20 characters. With 15 it would be...(matches my examples but some will be cut off...) Table 2: Dimname 2100000 Olap solutition 2200000 Building a ship \Michael V. "Allan Mitchell" <allan (AT) no-spam (DOT) sqldts.com> skrev i en meddelelse news:%23RlvodUTEHA.2416 (AT) TK2MSFTNGP09 (DOT) phx.gbl... Could you show us some structure, before data and what you want to see post change? Cursors are not always a problem but should be avoided if you can. -- ---------------------------- Allan Mitchell MCSE,MCDBA, (Microsoft SQL Server MVP) www.SQLDTS.com - The site for all your DTS needs. I support PASS - the definitive, global community for SQL Server professionals - http://www.sqlpass.org "Michael Vardinghus" <michaelvardinghus (AT) notexisting (DOT) com> wrote in message news:O74T%23NUTEHA.240 (AT) TK2MSFTNGP11 (DOT) phx.gbl... Have a table with 9 digit dimensioncode...need to make a new table with a 7 digit dimensioncode...is there any way I can get the name of the first 9 digit dimensioncode and use it as name for the new 7 digit dimensioncode ? Without using Cursors ? Perhaps Cursors isn't a problem with only 50.000 records...? \Michael Vardinghus |
![]() |
| Thread Tools | |
| Display Modes | |
| |