Click here to Skip to main content
15,887,485 members
Home / Discussions / Database
   

Database

 
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 
GeneralRe: Login failed. The login is from an untrusted domain and cannot be used with Windows authentication. Pin
ap_wooka27-May-10 10:11
ap_wooka27-May-10 10:11 
GeneralRe: Login failed. The login is from an untrusted domain and cannot be used with Windows authentication. Pin
Ashfield27-May-10 23:09
Ashfield27-May-10 23:09 
GeneralRe: Login failed. The login is from an untrusted domain and cannot be used with Windows authentication. Pin
poparosa27-Oct-10 8:35
poparosa27-Oct-10 8:35 
AnswerRe: Login failed. The login is from an untrusted domain and cannot be used with Windows authentication. Pin
liviucatrina13-Apr-10 4:24
liviucatrina13-Apr-10 4:24 
GeneralSQL IF statement Pin
DBLearner15-Apr-09 8:31
DBLearner15-Apr-09 8:31 
GeneralRe: SQL IF statement Pin
Luc 64801115-Apr-09 8:47
Luc 64801115-Apr-09 8:47 
GeneralRe: SQL IF statement Pin
DBLearner15-Apr-09 9:00
DBLearner15-Apr-09 9:00 
GeneralRe: SQL IF statement Pin
Luc 64801115-Apr-09 9:02
Luc 64801115-Apr-09 9:02 
GeneralRe: SQL IF statement Pin
Ashfield15-Apr-09 9:47
Ashfield15-Apr-09 9:47 
GeneralRe: SQL IF statement Pin
DBLearner17-Apr-09 1:08
DBLearner17-Apr-09 1:08 
GeneralRe: SQL IF statement Pin
Ashfield17-Apr-09 1:49
Ashfield17-Apr-09 1:49 
QuestionAny shorter way to total this? Pin
Muammar©14-Apr-09 21:10
Muammar©14-Apr-09 21:10 
AnswerRe: Any shorter way to total this? Pin
Giorgi Dalakishvili14-Apr-09 21:30
mentorGiorgi Dalakishvili14-Apr-09 21:30 

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.