|
DECLARE @NextString NVARCHAR(40)
DECLARE @Pos INT
DECLARE @NextPos INT
DECLARE @String NVARCHAR(40)
DECLARE @Delimiter NVARCHAR(40)
SET @String ='softdev,sup'
SET @Delimiter = ','
SET @String = @String + @Delimiter
SET @Pos = charindex(@Delimiter,@String)
WHILE (@pos <> 0)
BEGIN
SET @NextString = substring(@String,1,@Pos - 1)
SELECT @NextString -- Show Results
SET @String = substring(@String,@pos+1,len(@String))
SET @pos = charindex(@Delimiter,@String)
END
Result
- Softdev
- sup
Best Of Regards,
SOFTDEV
If you have knowledge, let others light their candles at it
|
|
|
|
|
do a string replace:
pseudocode:
string sLineFeed = "\n"; (or vbCrLf for Visual Basic or <br> for HTML)
string sSource = "A,B,C,D,E,F,G";
string sDestintion = replace(sSource,",",sLineFeed)
Rob
http://tagyurit.com
r
|
|
|
|
|
Use this function :
CREATE FUNCTION [dbo].[FN_STRINGTOTABLE](@P_STRING VARCHAR(8000), @P_DELIMITER CHAR(1))
RETURNS @P_TEMPTABLE TABLE
(ITEMS VARCHAR(8000))
AS
BEGIN
DECLARE @V_IDX INT
DECLARE @V_SLICE VARCHAR(8000)
SELECT @V_IDX = 1
IF LEN(@P_STRING)<1 OR @P_STRING IS NULL RETURN
WHILE @V_IDX != 0
BEGIN
SET @V_IDX = CHARINDEX(@P_DELIMITER,@P_STRING)
IF @V_IDX !=0
SET @V_SLICE = LEFT(@P_STRING,@V_IDX - 1)
ELSE
SET @V_SLICE = @P_STRING
IF(LEN(@V_SLICE)>0)
INSERT INTO @P_TEMPTABLE(ITEMS) VALUES(@V_SLICE)
SET @P_STRING = RIGHT(@P_STRING,LEN(@P_STRING) - @V_IDX)
IF LEN(@P_STRING) = 0 BREAK
END
RETURN
END
This will work great.
|
|
|
|
|
Why?
|
|
|
|
|
I have a source of a 2007 excel workbook and of the data is there that needs to be there for the import to the SQL 2008 destination table. i.e all "not null" fields are populated and mapped except the primary key which happens to be a unique identifier datatype.
I have tried creating a column using the NEWSEQUENTIALID() function in the first row.....that works for inserting nulls into a "shell" db but it fails everytime on the destination table that has a primaery key on the field and unique identifer as the data type.
Question:
How do I generate the GUIDS (unique identifers) from a DTSX package?
Is there a work around? I have spent the whole night trying everything except the right way.
Any help is greatly appreciated.
Thanks,
Regards,
Hulicat
|
|
|
|
|
Hulicat wrote: How do I generate the GUIDS (unique identifers) from a DTSX package?
ExecuteSql task with a call to NEWID()
Script Task with a call to new Guid()
take your pick.
|
|
|
|
|
hi every body
im having a big problem.
icant connect to my data base.
i have this error
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
i dont know what to do please help me
|
|
|
|
|
Is Remote Connection enabled for your SQL server instance?
Goto
Configuration Tools >> SQL SErver Surface Area Configuration >> Surface area configuration for services and connections
Enable the remote connection by selecting local and remote connection (using both TCP/IP and named pipes)
HTH
|
|
|
|
|
thanks for your reply but it didnt work i try it many times before do u have any thing else?
|
|
|
|
|
Are you able to connect with SQL Server Management Studio?
|
|
|
|
|
|
What type of application did you connect with SQL Server? ASP.NET or Windows application?
What type of authentication are you using to connect?
|
|
|
|
|
Asp.net and im using mixed mode
my code
string m = "Data Source=./SQLEXPRESS;AttachDbFilename=C:/Program Files/Microsoft SQL Server/MSSQL.1/MSSQL/Data/TestData.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True";
SqlConnection mycon = new SqlConnection(m);
mycon.open();
|
|
|
|
|
|
You are missing DATABASE name in connection string.
|
|
|
|
|
So you are using Windows Authentication.
ASP.NET application will be running under ASPNET account if you open your site from local IIS.
Therefore the ASPNET may not have access to the database. Try to use SQL authentication.
Also the database path should look like C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\TestData.mdf. I am not sure ADO.NET will accept / in a path specification.
|
|
|
|
|
Is your connection string correct?
Post it
|
|
|
|
|
what is wrong with my connecting string????
|
|
|
|
|
|
i add database name but it give me the same result
what is ment by Verify that the instance name is correct ?????
|
|
|
|
|
Data Source=./SQLEXPRESS
./SQLEXPRESS
This is instance name.
Check in your management studio if this is correct.
HTH
|
|
|
|
|
just do the following steps
goto StartMenu ---->SqlServer----->Configuration Tools-------->SQL Server Configuration Manager
and check in NAMED PIPES protocol is enabled or not
Best Of Regards,
SOFTDEV
If you have knowledge, let others light their candles at it
|
|
|
|
|
i enabled it and it suggest to restart sql what to do next????
|
|
|
|
|
Restart your pc or restart the SQL services.
Control Panel > Administrative Tools > Services
|
|
|
|
|
ops
it didnt work ido all thing but the same problem occured
|
|
|
|