I have a comma separated input parameter @EmployeeId that contains the following values: '123','234','246'.
How can I break them up into a temp table(#Employees) so that I can then write a query against them. Something like this:
SELECT *
FROM SALES s
INNER JOIN #EMPLOYEES e
ON s.empId =...
Can I select into a #TEMP table using dynamic sql?
For example:
SET @sSQL = 'SELECT * INTO #TEMP FROM ' + @sTable
EXEC (@sSQL)
I'm getting an invalid object name error when trying to select from #TEMP.
Thanks,
Ninel
Thank you all for helping me out. I really appreciate it.
I'd like to add something else...
How can I update the PunchOut with the PunchIn time, but minus a second?
Declare @Temp Table(EmpId Integer, Project VarChar(10), PunchIn SmallDateTime, Punchout SmallDateTime)
Insert Into @Temp...
I have a table that contains employees punchin and punchout times.
An employee can punchin and out multiple times during day(Lunch/Breaks). Sometimes they forget to punch out, but punch in again. So I can have records that look like this:
EmpId Project PunchIn PunchOut
1 A...
I need to execute the following select statement dynamically:
SELECT @RC = count(*)
FROM @sTable
WHERE Calldate = @sCalldate
When I write it like this I get errors..
EXEC ('SELECT ' + @RC + ' = count(*)
FROM ' + @sTable +
' WHERE Calldate = ' + @sCalldate)
IS there any way I can do this...
I have a web page that creates a text file and saves it to a network folder.
The problem is that I am getting access is denied errors.
Does this have to do with the asp.net account? I gave the netowrk folder read/write rights to the asp.net user.
Am I missing something? Do I need to write...
I have a database whose transaction log is 22867.367 mb. I need to truncate it. I used the following command:
backup log mydatabase with truncate_only and the only difference I noticed was that the Log Space Used went down. The Log size didn't change.
What commands should I be using to...
I actually found other code that worked:
ddlDept.SelectedIndex = ddlDept.Items.IndexOf(ddlDept.Items.FindByValue(iMsDepartmentId))
Thank you jbenson001 for all your help. I really appreciate it. Sometimes I think I don't know where I would be without all the help I receive from the forums.
I'm really sorry to keep bugging you about this.
If you take a look at my code above, I'm populating a datareader with the info from my database. Would the datareader work? What would I put in the parenthesis with thw datareader? I am soo confused....can you tell?
Am I misunderstanding this?
I want the the position "IT" to appear selected in the dropdown, but when clicking the dropdown to see the other positions, I want to see the list that came back from the database.
The .FindByValue will do this for me?
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.