Click here to Skip to main content
15,896,726 members
Home / Discussions / Database
   

Database

 
GeneralRe: Query HElppp.....!!!!! Pin
Rajesh Anuhya17-Apr-09 0:24
professionalRajesh Anuhya17-Apr-09 0:24 
GeneralRe: Query HElppp.....!!!!! Pin
Marla Sukesh17-Apr-09 1:02
professional Marla Sukesh17-Apr-09 1:02 
GeneralRe: Query HElppp.....!!!!! Pin
Rajesh Anuhya17-Apr-09 1:18
professionalRajesh Anuhya17-Apr-09 1:18 
AnswerRe: Query HElppp.....!!!!! Pin
Marla Sukesh17-Apr-09 1:27
professional Marla Sukesh17-Apr-09 1:27 
AnswerRe: Query HElppp.....!!!!! Pin
Luc Pattyn17-Apr-09 2:14
sitebuilderLuc Pattyn17-Apr-09 2:14 
QuestionProblem with Identity Specification in SQL Server 2008 Pin
Krishnraj16-Apr-09 21:06
Krishnraj16-Apr-09 21:06 
NewsSyncFolder Pin
blazers4u16-Apr-09 19:32
blazers4u16-Apr-09 19:32 
GeneralRe: SyncFolder Pin
Ashfield16-Apr-09 20:59
Ashfield16-Apr-09 20:59 
QuestionUsing Extended stored proc's within functions / dynamic SQL Pin
ruanr16-Apr-09 1:49
ruanr16-Apr-09 1:49 
QuestionOutput Pin
jonhbt16-Apr-09 1:30
jonhbt16-Apr-09 1:30 
AnswerRe: Output Pin
scottgp16-Apr-09 2:33
professionalscottgp16-Apr-09 2:33 
AnswerRe: Output Pin
Kevin Horgan16-Apr-09 21:01
Kevin Horgan16-Apr-09 21:01 
QuestionMS SQL query syntax for full text search Pin
Vishnu Nath15-Apr-09 21:56
Vishnu Nath15-Apr-09 21:56 
AnswerRe: MS SQL query syntax for full text search Pin
Rajesh Anuhya16-Apr-09 22:02
professionalRajesh Anuhya16-Apr-09 22:02 
AnswerRe: MS SQL query syntax for full text search Pin
Member 77074615-Mar-10 6:39
Member 77074615-Mar-10 6:39 
QuestionDateTime Problem Pin
jonhbt15-Apr-09 21:24
jonhbt15-Apr-09 21:24 
AnswerRe: DateTime Problem Pin
Kevin Horgan15-Apr-09 21:43
Kevin Horgan15-Apr-09 21:43 
GeneralRe: DateTime Problem Pin
jonhbt15-Apr-09 22:05
jonhbt15-Apr-09 22:05 
GeneralRe: DateTime Problem Pin
Kevin Horgan15-Apr-09 22:19
Kevin Horgan15-Apr-09 22:19 
GeneralRe: DateTime Problem Pin
jonhbt15-Apr-09 22:43
jonhbt15-Apr-09 22:43 
AnswerRe: DateTime Problem Pin
Kevin Horgan15-Apr-09 22:55
Kevin Horgan15-Apr-09 22:55 
Hi again,

One thing I just noticed is you need a SPACE before the "WHERE clause" in the SQL example code you posted above. At the moment it dynamic SQL command looks like this.

Select * From HRS_STAGING.dbo.IM_DOC_TRANSFORMWhere Last_Documented_Date_And_Time = CAST('2009-03-02 12:46:00.000' AS DATETIME)

Try adding a space as follows. I have also replaced the "||" with "+" if you would prefer this method of concatenation.

declare @v_update_sql varchar(1000)
declare @d_date char(23)
select @d_date = '2009-03-02 12:46:00.000'
declare @sql varchar(1000)
declare @v_target_table_name varchar(100)
Set @v_target_table_name = 'IM_DOC_TRANSFORM'
Set @v_update_sql = 'Select * From HRS_STAGING.dbo.'+ @v_target_table_name + ' Where Last_Documented_Date_And_Time = CAST('''+@d_Date+''' AS DATETIME)'

select @v_update_sql
execute (@v_update_sql)

The dynamic SQL should then look like this...

Select * From HRS_STAGING.dbo.IM_DOC_TRANSFORM Where Last_Documented_Date_And_Time = CAST('2009-03-02 12:46:00.000' AS DATETIME)

See if that works for you.

Cheers,

Kevin
GeneralRe: DateTime Problem Pin
jonhbt15-Apr-09 23:11
jonhbt15-Apr-09 23:11 
QuestionWhat is the meaning of Output Variable in sp_xml_preparedocument Pin
kiran.parab15-Apr-09 19:20
kiran.parab15-Apr-09 19:20 
QuestionLogin failed. The login is from an untrusted domain and cannot be used with Windows authentication. Pin
bLeZy15-Apr-09 17:07
bLeZy15-Apr-09 17:07 
AnswerRe: Login failed. The login is from an untrusted domain and cannot be used with Windows authentication. Pin
Ashfield15-Apr-09 20:59
Ashfield15-Apr-09 20:59 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.