Wrox Programmer Forums
|
SQL Server DTS Discussion specific to Data Transformation Service with SQL Server. General SQL Server discussions should use the general SQL Server forum. Readers of the book Professional SQL Server 2000 DTS with questions specific to that book should post in that book forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server DTS section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 13th, 2005, 01:46 AM
Registered User
 
Join Date: Jun 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Excute Insert

Hallo, i don't understant where is mistake ..
Table = AAA , field pole1 is varchar (100)

declare @tmp varchar(30)
Set @tmp='abcdef'
execute ('INSERT into AAA (pole1) Values( '+ @tmp+' )')

and there is error

Server: Msg 128, Level 15, State 1, Line 1
The name 'abcdef' is not permitted in this context. Only constants, expressions, or variables allowed here. Column names are not permitted.

Help me please, Thanks, Lubo

 
Old July 1st, 2005, 12:25 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Execute ('INSERT into AAA (pole1) Values( '''+@tmp+''' )')
 
Old July 13th, 2005, 01:50 AM
Authorized User
 
Join Date: Mar 2005
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default

jbenson001 is right, becoz u will have to terminate the string inside exec itself.
Atul






Similar Threads
Thread Thread Starter Forum Replies Last Post
How to insert " ". Somesh XML 1 March 6th, 2007 01:30 PM
How to insert " ". Somesh C# 1 March 6th, 2007 08:45 AM
insert into U.N.C.L.E. SQL Language 3 June 6th, 2006 06:35 PM
trigger to insert current date on insert kev_79 SQL Server 2000 3 January 23rd, 2006 05:58 PM
Insert into jemacc SQL Server 2000 2 March 31st, 2004 08:31 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.